[email protected] | c6b207c | 2012-01-25 04:25:45 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 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_ | ||||
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 7 | |
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 8 | #include <vector> |
9 | |||||
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 10 | #include "base/compiler_specific.h" |
avi | 664c07b | 2015-12-26 02:18:31 | [diff] [blame] | 11 | #include "base/macros.h" |
[email protected] | 1ba55cf | 2012-06-29 19:11:39 | [diff] [blame] | 12 | #include "chrome/browser/ui/global_error/global_error.h" |
[email protected] | 8e37b2cd | 2014-03-28 16:25:51 | [diff] [blame] | 13 | #include "components/keyed_service/core/keyed_service.h" |
maxbogue | 455a57e3 | 2016-08-14 00:08:32 | [diff] [blame] | 14 | #include "components/sync/driver/sync_error_controller.h" |
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 15 | |
blundell | 6054298 | 2015-11-04 20:47:38 | [diff] [blame] | 16 | class GlobalErrorService; |
17 | class LoginUIService; | ||||
maxbogue | 0a37945 | 2016-09-22 21:35:05 | [diff] [blame] | 18 | |
19 | namespace browser_sync { | ||||
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 20 | class ProfileSyncService; |
maxbogue | 0a37945 | 2016-09-22 21:35:05 | [diff] [blame] | 21 | } // namespace browser_sync |
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 22 | |
[email protected] | 8e37b2cd | 2014-03-28 16:25:51 | [diff] [blame] | 23 | // Shows sync errors on the wrench menu using a bubble view and a menu item. |
[email protected] | 4deac0de | 2013-11-01 17:20:06 | [diff] [blame] | 24 | class SyncGlobalError : public GlobalErrorWithStandardBubble, |
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 25 | public syncer::SyncErrorController::Observer, |
[email protected] | 8e37b2cd | 2014-03-28 16:25:51 | [diff] [blame] | 26 | public KeyedService { |
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 27 | public: |
blundell | 6054298 | 2015-11-04 20:47:38 | [diff] [blame] | 28 | SyncGlobalError(GlobalErrorService* global_error_service, |
29 | LoginUIService* login_ui_service, | ||||
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 30 | syncer::SyncErrorController* error_controller, |
maxbogue | 0a37945 | 2016-09-22 21:35:05 | [diff] [blame] | 31 | browser_sync::ProfileSyncService* profile_sync_service); |
dcheng | 0cd9ff9 | 2014-10-21 11:13:07 | [diff] [blame] | 32 | ~SyncGlobalError() override; |
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 33 | |
[email protected] | 8e37b2cd | 2014-03-28 16:25:51 | [diff] [blame] | 34 | // KeyedService: |
dcheng | 0cd9ff9 | 2014-10-21 11:13:07 | [diff] [blame] | 35 | void Shutdown() override; |
[email protected] | 8e37b2cd | 2014-03-28 16:25:51 | [diff] [blame] | 36 | |
37 | // GlobalErrorWithStandardBubble: | ||||
dcheng | 0cd9ff9 | 2014-10-21 11:13:07 | [diff] [blame] | 38 | bool HasMenuItem() override; |
39 | int MenuItemCommandID() override; | ||||
40 | base::string16 MenuItemLabel() override; | ||||
41 | void ExecuteMenuItem(Browser* browser) override; | ||||
42 | bool HasBubbleView() override; | ||||
43 | base::string16 GetBubbleViewTitle() override; | ||||
44 | std::vector<base::string16> GetBubbleViewMessages() override; | ||||
45 | base::string16 GetBubbleViewAcceptButtonLabel() override; | ||||
46 | base::string16 GetBubbleViewCancelButtonLabel() override; | ||||
47 | void OnBubbleViewDidClose(Browser* browser) override; | ||||
48 | void BubbleViewAcceptButtonPressed(Browser* browser) override; | ||||
49 | void BubbleViewCancelButtonPressed(Browser* browser) override; | ||||
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 50 | |
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 51 | // syncer::SyncErrorController::Observer: |
dcheng | 0cd9ff9 | 2014-10-21 11:13:07 | [diff] [blame] | 52 | void OnErrorChanged() override; |
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 53 | |
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 54 | private: |
[email protected] | a04db82 | 2013-12-11 19:14:40 | [diff] [blame] | 55 | base::string16 bubble_accept_label_; |
56 | base::string16 bubble_message_; | ||||
57 | base::string16 menu_label_; | ||||
[email protected] | 8e37b2cd | 2014-03-28 16:25:51 | [diff] [blame] | 58 | |
blundell | 6054298 | 2015-11-04 20:47:38 | [diff] [blame] | 59 | GlobalErrorService* global_error_service_; |
60 | |||||
61 | const LoginUIService* login_ui_service_; | ||||
62 | |||||
[email protected] | 8e37b2cd | 2014-03-28 16:25:51 | [diff] [blame] | 63 | // The error controller to query for error details. Owned by the |
64 | // ProfileSyncService this SyncGlobalError depends on. | ||||
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 65 | syncer::SyncErrorController* error_controller_; |
[email protected] | 8e37b2cd | 2014-03-28 16:25:51 | [diff] [blame] | 66 | |
maxbogue | 0a37945 | 2016-09-22 21:35:05 | [diff] [blame] | 67 | const browser_sync::ProfileSyncService* sync_service_; |
[email protected] | 2710ca6 | 2011-09-21 00:52:52 | [diff] [blame] | 68 | |
69 | DISALLOW_COPY_AND_ASSIGN(SyncGlobalError); | ||||
70 | }; | ||||
71 | |||||
72 | #endif // CHROME_BROWSER_SYNC_SYNC_GLOBAL_ERROR_H_ |