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.
5 #ifndef CHROME_BROWSER_SYNC_SYNC_GLOBAL_ERROR_H_
6 #define CHROME_BROWSER_SYNC_SYNC_GLOBAL_ERROR_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/ui/global_error/global_error.h"
11 #include "components/keyed_service/core/keyed_service.h"
12 #include "components/sync_driver/sync_error_controller.h"
14 class ProfileSyncService
;
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
,
21 SyncGlobalError(SyncErrorController
* error_controller
,
22 ProfileSyncService
* profile_sync_service
);
23 ~SyncGlobalError() override
;
26 void Shutdown() override
;
28 // GlobalErrorWithStandardBubble:
29 bool HasMenuItem() override
;
30 int MenuItemCommandID() override
;
31 base::string16
MenuItemLabel() override
;
32 void ExecuteMenuItem(Browser
* browser
) override
;
33 bool HasBubbleView() override
;
34 base::string16
GetBubbleViewTitle() override
;
35 std::vector
<base::string16
> GetBubbleViewMessages() override
;
36 base::string16
GetBubbleViewAcceptButtonLabel() override
;
37 base::string16
GetBubbleViewCancelButtonLabel() override
;
38 void OnBubbleViewDidClose(Browser
* browser
) override
;
39 void BubbleViewAcceptButtonPressed(Browser
* browser
) override
;
40 void BubbleViewCancelButtonPressed(Browser
* browser
) override
;
42 // SyncErrorController::Observer:
43 void OnErrorChanged() override
;
46 base::string16 bubble_accept_label_
;
47 base::string16 bubble_message_
;
48 base::string16 menu_label_
;
50 // The error controller to query for error details. Owned by the
51 // ProfileSyncService this SyncGlobalError depends on.
52 SyncErrorController
* error_controller_
;
54 const ProfileSyncService
* service_
;
56 DISALLOW_COPY_AND_ASSIGN(SyncGlobalError
);
59 #endif // CHROME_BROWSER_SYNC_SYNC_GLOBAL_ERROR_H_