1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_MAC_H_
6#define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_MAC_H_
7
8#import <AppKit/AppKit.h>
9
10#include "base/compiler_specific.h"
11#include "base/mac/scoped_nsobject.h"
12#include "chrome/browser/ui/webui/help/version_updater.h"
13
14@class KeystoneObserver;
15
16// OS X implementation of version update functionality, used by the WebUI
17// About/Help page.
18class VersionUpdaterMac : public VersionUpdater {
19 public:
20  // VersionUpdater implementation.
21  virtual void CheckForUpdate(const StatusCallback& status_callback,
22                              const PromoteCallback& promote_callback) OVERRIDE;
23  virtual void PromoteUpdater() const OVERRIDE;
24  virtual void RelaunchBrowser() const OVERRIDE;
25
26  // Process status updates received from Keystone. The dictionary will contain
27  // an AutoupdateStatus value as an intValue at key kAutoupdateStatusStatus. If
28  // a version is available (see AutoupdateStatus), it will be present at key
29  // kAutoupdateStatusVersion.
30  void UpdateStatus(NSDictionary* status);
31
32 protected:
33  friend class VersionUpdater;
34
35  // Clients must use VersionUpdater::Create().
36  VersionUpdaterMac();
37  virtual ~VersionUpdaterMac();
38
39 private:
40  // Update the visibility state of promote button.
41  void UpdateShowPromoteButton();
42
43  // Callback used to communicate update status to the client.
44  StatusCallback status_callback_;
45
46  // Callback used to show or hide the promote UI elements.
47  PromoteCallback promote_callback_;
48
49  // The visible state of the promote button.
50  bool show_promote_button_;
51
52  // The observer that will receive keystone status updates.
53  base::scoped_nsobject<KeystoneObserver> keystone_observer_;
54
55  DISALLOW_COPY_AND_ASSIGN(VersionUpdaterMac);
56};
57
58#endif  // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_MAC_H_
59
60