blob: cf801bbb6e89fdfc367a26a673ec552946c96fe7 [file] [log] [blame]
[email protected]c6b207c2012-01-25 04:25:451// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]2710ca62011-09-21 00:52:522// 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]2710ca62011-09-21 00:52:527
maxbogue7e006db2016-10-03 19:48:288#include <vector>
9
[email protected]2710ca62011-09-21 00:52:5210#include "base/compiler_specific.h"
avi664c07b2015-12-26 02:18:3111#include "base/macros.h"
[email protected]1ba55cf2012-06-29 19:11:3912#include "chrome/browser/ui/global_error/global_error.h"
[email protected]8e37b2cd2014-03-28 16:25:5113#include "components/keyed_service/core/keyed_service.h"
maxbogue455a57e32016-08-14 00:08:3214#include "components/sync/driver/sync_error_controller.h"
[email protected]2710ca62011-09-21 00:52:5215
blundell60542982015-11-04 20:47:3816class GlobalErrorService;
17class LoginUIService;
maxbogue0a379452016-09-22 21:35:0518
19namespace browser_sync {
[email protected]2710ca62011-09-21 00:52:5220class ProfileSyncService;
maxbogue0a379452016-09-22 21:35:0521} // namespace browser_sync
[email protected]2710ca62011-09-21 00:52:5222
[email protected]8e37b2cd2014-03-28 16:25:5123// Shows sync errors on the wrench menu using a bubble view and a menu item.
[email protected]4deac0de2013-11-01 17:20:0624class SyncGlobalError : public GlobalErrorWithStandardBubble,
maxbogue7e006db2016-10-03 19:48:2825 public syncer::SyncErrorController::Observer,
[email protected]8e37b2cd2014-03-28 16:25:5126 public KeyedService {
[email protected]2710ca62011-09-21 00:52:5227 public:
blundell60542982015-11-04 20:47:3828 SyncGlobalError(GlobalErrorService* global_error_service,
29 LoginUIService* login_ui_service,
maxbogue7e006db2016-10-03 19:48:2830 syncer::SyncErrorController* error_controller,
maxbogue0a379452016-09-22 21:35:0531 browser_sync::ProfileSyncService* profile_sync_service);
dcheng0cd9ff92014-10-21 11:13:0732 ~SyncGlobalError() override;
[email protected]2710ca62011-09-21 00:52:5233
[email protected]8e37b2cd2014-03-28 16:25:5134 // KeyedService:
dcheng0cd9ff92014-10-21 11:13:0735 void Shutdown() override;
[email protected]8e37b2cd2014-03-28 16:25:5136
37 // GlobalErrorWithStandardBubble:
dcheng0cd9ff92014-10-21 11:13:0738 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]2710ca62011-09-21 00:52:5250
maxbogue7e006db2016-10-03 19:48:2851 // syncer::SyncErrorController::Observer:
dcheng0cd9ff92014-10-21 11:13:0752 void OnErrorChanged() override;
[email protected]2710ca62011-09-21 00:52:5253
[email protected]2710ca62011-09-21 00:52:5254 private:
[email protected]a04db822013-12-11 19:14:4055 base::string16 bubble_accept_label_;
56 base::string16 bubble_message_;
57 base::string16 menu_label_;
[email protected]8e37b2cd2014-03-28 16:25:5158
blundell60542982015-11-04 20:47:3859 GlobalErrorService* global_error_service_;
60
61 const LoginUIService* login_ui_service_;
62
[email protected]8e37b2cd2014-03-28 16:25:5163 // The error controller to query for error details. Owned by the
64 // ProfileSyncService this SyncGlobalError depends on.
maxbogue7e006db2016-10-03 19:48:2865 syncer::SyncErrorController* error_controller_;
[email protected]8e37b2cd2014-03-28 16:25:5166
maxbogue0a379452016-09-22 21:35:0567 const browser_sync::ProfileSyncService* sync_service_;
[email protected]2710ca62011-09-21 00:52:5268
69 DISALLOW_COPY_AND_ASSIGN(SyncGlobalError);
70};
71
72#endif // CHROME_BROWSER_SYNC_SYNC_GLOBAL_ERROR_H_