• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/sync_error_controller.h"
11 #include "chrome/browser/ui/global_error/global_error.h"
12 #include "components/keyed_service/core/keyed_service.h"
13 
14 class ProfileSyncService;
15 
16 // Shows sync errors on the wrench menu using a bubble view and a menu item.
17 class SyncGlobalError : public GlobalErrorWithStandardBubble,
18                         public SyncErrorController::Observer,
19                         public KeyedService {
20  public:
21   SyncGlobalError(SyncErrorController* error_controller,
22                   ProfileSyncService* profile_sync_service);
23   virtual ~SyncGlobalError();
24 
25   // KeyedService:
26   virtual void Shutdown() OVERRIDE;
27 
28   // GlobalErrorWithStandardBubble:
29   virtual bool HasMenuItem() OVERRIDE;
30   virtual int MenuItemCommandID() OVERRIDE;
31   virtual base::string16 MenuItemLabel() OVERRIDE;
32   virtual void ExecuteMenuItem(Browser* browser) OVERRIDE;
33   virtual bool HasBubbleView() OVERRIDE;
34   virtual base::string16 GetBubbleViewTitle() OVERRIDE;
35   virtual std::vector<base::string16> GetBubbleViewMessages() OVERRIDE;
36   virtual base::string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
37   virtual base::string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
38   virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE;
39   virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE;
40   virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE;
41 
42   // SyncErrorController::Observer:
43   virtual void OnErrorChanged() OVERRIDE;
44 
45  private:
46   base::string16 bubble_accept_label_;
47   base::string16 bubble_message_;
48   base::string16 menu_label_;
49 
50   // The error controller to query for error details. Owned by the
51   // ProfileSyncService this SyncGlobalError depends on.
52   SyncErrorController* error_controller_;
53 
54   const ProfileSyncService* service_;
55 
56   DISALLOW_COPY_AND_ASSIGN(SyncGlobalError);
57 };
58 
59 #endif  // CHROME_BROWSER_SYNC_SYNC_GLOBAL_ERROR_H_
60