| Index: chrome/browser/protector/settings_change_global_error.h
|
| diff --git a/chrome/browser/protector/settings_change_global_error.h b/chrome/browser/protector/settings_change_global_error.h
|
| index 9e08df87e1308c5fc2ff50332ea22d01ac7a18d2..64cfec986c95cbd2312c624703ba8d8f302646dc 100644
|
| --- a/chrome/browser/protector/settings_change_global_error.h
|
| +++ b/chrome/browser/protector/settings_change_global_error.h
|
| @@ -6,45 +6,52 @@
|
| #define CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_
|
| #pragma once
|
|
|
| -#include <vector>
|
| -
|
| #include "base/basictypes.h"
|
| -#include "base/callback.h"
|
| #include "base/compiler_specific.h"
|
| -#include "base/string16.h"
|
| #include "base/memory/weak_ptr.h"
|
| +#include "chrome/browser/protector/setting_change.h"
|
| #include "chrome/browser/ui/global_error.h"
|
|
|
| +class Browser;
|
| class Profile;
|
|
|
| +namespace protector {
|
| +
|
| // Global error about unwanted settings changes.
|
| class SettingsChangeGlobalError : public GlobalError {
|
| public:
|
| - enum ChangeType {
|
| - kSearchEngineChanged = 0, // Default search engine has been changed.
|
| - kHomePageChanged, // Home page has been changed.
|
| - };
|
| + // Interface for notifications about bubble closing.
|
| + class Delegate {
|
| + public:
|
| + virtual ~Delegate() {}
|
|
|
| - struct Change {
|
| - ChangeType type; // Which setting has been changed.
|
| - string16 old_setting; // Old setting value or "" if unknown.
|
| - string16 new_setting; // New setting value.
|
| - };
|
| + // Called if user clicks "Apply change" button.
|
| + virtual void OnApplyChanges() = 0;
|
|
|
| - typedef std::vector<Change> ChangesVector;
|
| + // Called if user clicks "Discard change" button.
|
| + virtual void OnDiscardChanges() = 0;
|
| +
|
| + // Called if user clicked outside the bubble and timeout for its reshow
|
| + // has passed.
|
| + virtual void OnDecisionTimeout() = 0;
|
| + };
|
|
|
| // Creates new global error about settings changes |changes|.
|
| - // If user decides to apply changes, |apply_changes_cb| is called.
|
| - // If user decides to keep previous settings, |revert_changes_cb| is called.
|
| - SettingsChangeGlobalError(const ChangesVector& changes,
|
| - const base::Closure& apply_changes_cb,
|
| - const base::Closure& revert_changes_cb);
|
| + // Uses |delegate| to notify about user decision.
|
| + SettingsChangeGlobalError(const SettingChangeVector& changes,
|
| + Delegate* delegate);
|
| virtual ~SettingsChangeGlobalError();
|
|
|
| // Displays a global error bubble for the default browser profile.
|
| // Can be called from any thread.
|
| void ShowForDefaultProfile();
|
|
|
| + // Profile that we have been added to.
|
| + Profile* profile() const { return profile_; }
|
| +
|
| + // Browser that the bubble has been last time shown for.
|
| + Browser* browser() const { return browser_; }
|
| +
|
| // GlobalError implementation.
|
| virtual bool HasBadge() OVERRIDE;
|
| virtual bool HasMenuItem() OVERRIDE;
|
| @@ -62,19 +69,6 @@ class SettingsChangeGlobalError : public GlobalError {
|
| virtual void BubbleViewCancelButtonPressed() OVERRIDE;
|
|
|
| private:
|
| - ChangesVector changes_;
|
| -
|
| - base::Closure apply_changes_cb_;
|
| - base::Closure revert_changes_cb_;
|
| -
|
| - // Profile that we have been added to.
|
| - Profile* profile_;
|
| -
|
| - // True if user has dismissed the bubble by clicking on one of the buttons.
|
| - bool closed_by_button_;
|
| -
|
| - base::WeakPtrFactory<SettingsChangeGlobalError> weak_factory_;
|
| -
|
| // Helper called on the UI thread to add this global error to the default
|
| // profile (stored in |profile_|).
|
| void AddToDefaultProfile();
|
| @@ -85,7 +79,26 @@ class SettingsChangeGlobalError : public GlobalError {
|
| // Removes global error from its profile and deletes |this| later.
|
| void RemoveFromProfile();
|
|
|
| + // List of changes to show.
|
| + SettingChangeVector changes_;
|
| +
|
| + // Delegate to notify about user actions.
|
| + Delegate* delegate_;
|
| +
|
| + // Profile that we have been added to.
|
| + Profile* profile_;
|
| +
|
| + // Browser that we have been shown for.
|
| + Browser* browser_;
|
| +
|
| + // True if user has dismissed the bubble by clicking on one of the buttons.
|
| + bool closed_by_button_;
|
| +
|
| + base::WeakPtrFactory<SettingsChangeGlobalError> weak_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(SettingsChangeGlobalError);
|
| };
|
|
|
| +} // namespace protector
|
| +
|
| #endif // CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_
|
|
|