| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PROTECTOR_PROTECTOR_H_ |
| 6 #define CHROME_BROWSER_PROTECTOR_PROTECTOR_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/task.h" |
| 16 #include "chrome/browser/protector/setting_change.h" |
| 17 #include "chrome/browser/protector/settings_change_global_error.h" |
| 18 |
| 19 class GURL; |
| 20 class TemplateURLService; |
| 21 |
| 22 namespace protector { |
| 23 |
| 24 // Accumulates settings changes and shows them altogether to user. |
| 25 // Owns itself and is destroyed when user accepted or discarded changes (by |
| 26 // action or by default in case bubble and menu item are ignored). |
| 27 class Protector : public SettingsChangeGlobalError::Delegate { |
| 28 public: |
| 29 Protector(); |
| 30 |
| 31 // Add info about single setting change to the list of changes to notify |
| 32 // about. Does nothing if we're showing changes already. |
| 33 void AddChange(SettingChange* change); |
| 34 |
| 35 // Shows error bubble to user about settings changes. The result is either |
| 36 // accept or decline of the change. |
| 37 void NotifyUser(); |
| 38 |
| 39 // Opens a tab with specified URL in the browser window we've shown error |
| 40 // bubble for. |
| 41 void OpenTab(const GURL& url); |
| 42 |
| 43 // Returns TemplateURLService for the profile we've shown error bubble |
| 44 // for. |
| 45 TemplateURLService* GetTemplateURLService(); |
| 46 |
| 47 // SettingsChangeGlobalError::Delegate implementation: |
| 48 virtual void OnApplyChanges() OVERRIDE; |
| 49 virtual void OnDiscardChanges() OVERRIDE; |
| 50 virtual void OnDecisionTimeout() OVERRIDE; |
| 51 |
| 52 private: |
| 53 friend class DeleteTask<Protector>; |
| 54 |
| 55 ~Protector(); |
| 56 |
| 57 // All changes we want to show. |
| 58 SettingChangeVector changes_; |
| 59 |
| 60 // Pointer to error bubble controller. Indicates if we're showing change |
| 61 // notification to user. |
| 62 scoped_ptr<SettingsChangeGlobalError> error_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(Protector); |
| 65 }; |
| 66 |
| 67 // Shows notification about a single setting change. |
| 68 // Passes ownership of |change| to Protector instance. |
| 69 void NotifyUserOfChange(SettingChange* change); |
| 70 |
| 71 // Signs string value with protector's key. |
| 72 std::string SignSetting(const std::string& value); |
| 73 |
| 74 } // namespace protector |
| 75 |
| 76 #endif // CHROME_BROWSER_PROTECTOR_PROTECTOR_H_ |
| OLD | NEW |