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_SYNC_SYNC_GLOBAL_ERROR_H_
6#define CHROME_BROWSER_SYNC_SYNC_GLOBAL_ERROR_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "chrome/browser/sync/profile_sync_service_observer.h"
11#include "chrome/browser/ui/global_error/global_error.h"
12
13class ProfileSyncService;
14class SigninManagerBase;
15
16// Shows sync errors on the wrench menu using a bubble view and a
17// menu item.
18class SyncGlobalError : public GlobalErrorWithStandardBubble,
19                        public ProfileSyncServiceObserver {
20 public:
21  SyncGlobalError(ProfileSyncService* service, SigninManagerBase* signin);
22  virtual ~SyncGlobalError();
23
24  virtual bool HasMenuItem() OVERRIDE;
25  virtual int MenuItemCommandID() OVERRIDE;
26  virtual base::string16 MenuItemLabel() OVERRIDE;
27  virtual void ExecuteMenuItem(Browser* browser) OVERRIDE;
28
29  virtual bool HasBubbleView() OVERRIDE;
30  virtual base::string16 GetBubbleViewTitle() OVERRIDE;
31  virtual std::vector<base::string16> GetBubbleViewMessages() OVERRIDE;
32  virtual base::string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
33  virtual base::string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
34  virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE;
35  virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE;
36  virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE;
37
38  // ProfileSyncServiceObserver implementation.
39  virtual void OnStateChanged() OVERRIDE;
40
41 private:
42  base::string16 bubble_accept_label_;
43  base::string16 bubble_message_;
44  base::string16 menu_label_;
45  ProfileSyncService* service_;
46  SigninManagerBase* signin_;
47
48  DISALLOW_COPY_AND_ASSIGN(SyncGlobalError);
49};
50
51#endif  // CHROME_BROWSER_SYNC_SYNC_GLOBAL_ERROR_H_
52