| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ | 5 #ifndef CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ |
| 6 #define CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ | 6 #define CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/protector/base_setting_change.h" | 12 #include "chrome/browser/protector/base_setting_change.h" |
| 13 #include "chrome/browser/ui/browser_list_observer.h" | 13 #include "chrome/browser/ui/browser_list_observer.h" |
| 14 #include "chrome/browser/ui/global_error/global_error.h" | 14 #include "chrome/browser/ui/global_error/global_error.h" |
| 15 #include "chrome/browser/ui/host_desktop.h" |
| 15 | 16 |
| 16 class Browser; | 17 class Browser; |
| 17 class Profile; | 18 class Profile; |
| 18 | 19 |
| 19 namespace protector { | 20 namespace protector { |
| 20 | 21 |
| 21 class BaseSettingChange; | 22 class BaseSettingChange; |
| 22 class SettingsChangeGlobalErrorDelegate; | 23 class SettingsChangeGlobalErrorDelegate; |
| 23 | 24 |
| 24 // Global error about unwanted settings changes. | 25 // Global error about unwanted settings changes. |
| 25 class SettingsChangeGlobalError : public GlobalError, | 26 class SettingsChangeGlobalError : public GlobalError, |
| 26 public chrome::BrowserListObserver { | 27 public chrome::BrowserListObserver { |
| 27 public: | 28 public: |
| 28 // Creates new global error about setting changes |change| which must not be | 29 // Creates new global error about setting changes |change| which must not be |
| 29 // deleted until |delegate->OnRemovedFromProfile| is called. Uses |delegate| | 30 // deleted until |delegate->OnRemovedFromProfile| is called. Uses |delegate| |
| 30 // to notify about user decision. | 31 // to notify about user decision. |
| 31 SettingsChangeGlobalError(BaseSettingChange* change, | 32 SettingsChangeGlobalError(BaseSettingChange* change, |
| 32 SettingsChangeGlobalErrorDelegate* delegate); | 33 SettingsChangeGlobalErrorDelegate* delegate); |
| 33 virtual ~SettingsChangeGlobalError(); | 34 virtual ~SettingsChangeGlobalError(); |
| 34 | 35 |
| 35 // Adds a global error to the given browser profile and shows a bubble | 36 // Adds a global error to the given browser profile and shows a bubble |
| 36 // immediately if |show_bubble| is |true|. | 37 // immediately on the desktop specified by |desktop_type| if |show_bubble| is |
| 37 void AddToProfile(Profile* profile, bool show_bubble); | 38 // |true|. |
| 39 void AddToProfile(Profile* profile, |
| 40 bool show_bubble, |
| 41 chrome::HostDesktopType desktop_type); |
| 38 | 42 |
| 39 // Removes global error from its profile. | 43 // Removes global error from its profile. |
| 40 void RemoveFromProfile(); | 44 void RemoveFromProfile(); |
| 41 | 45 |
| 42 // Displays the bubble in the last active tabbed browser. | 46 // Displays the bubble in the last active tabbed browser on the desktop |
| 43 void ShowBubble(); | 47 // specified by |desktop_type|. |
| 48 void ShowBubble(chrome::HostDesktopType desktop_type); |
| 44 | 49 |
| 45 // Returns the change instance to which this error refers. | 50 // Returns the change instance to which this error refers. |
| 46 BaseSettingChange* change() { return change_; } | 51 BaseSettingChange* change() { return change_; } |
| 47 | 52 |
| 48 private: | 53 private: |
| 49 // GlobalError implementation. | 54 // GlobalError implementation. |
| 50 virtual bool HasBadge() OVERRIDE; | 55 virtual bool HasBadge() OVERRIDE; |
| 51 virtual int GetBadgeResourceID() OVERRIDE; | 56 virtual int GetBadgeResourceID() OVERRIDE; |
| 52 virtual bool HasMenuItem() OVERRIDE; | 57 virtual bool HasMenuItem() OVERRIDE; |
| 53 virtual int MenuItemCommandID() OVERRIDE; | 58 virtual int MenuItemCommandID() OVERRIDE; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 100 |
| 96 // Menu command ID assigned to |this| from the pool of available IDs. | 101 // Menu command ID assigned to |this| from the pool of available IDs. |
| 97 int menu_id_; | 102 int menu_id_; |
| 98 | 103 |
| 99 DISALLOW_COPY_AND_ASSIGN(SettingsChangeGlobalError); | 104 DISALLOW_COPY_AND_ASSIGN(SettingsChangeGlobalError); |
| 100 }; | 105 }; |
| 101 | 106 |
| 102 } // namespace protector | 107 } // namespace protector |
| 103 | 108 |
| 104 #endif // CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ | 109 #endif // CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ |
| OLD | NEW |