| 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 // Takes ownership over the object. |
| 34 void AddChange(SettingChange* change); |
| 35 |
| 36 // Shows error bubble to user about settings changes. The result is either |
| 37 // accept or decline of the change. |
| 38 void NotifyUser(); |
| 39 |
| 40 // Opens a tab with specified URL in the browser window we've shown error |
| 41 // bubble for. |
| 42 void OpenTab(const GURL& url); |
| 43 |
| 44 // Returns TemplateURLService for the profile we've shown error bubble |
| 45 // for. |
| 46 TemplateURLService* GetTemplateURLService(); |
| 47 |
| 48 // SettingsChangeGlobalError::Delegate implementation: |
| 49 virtual void OnApplyChanges() OVERRIDE; |
| 50 virtual void OnDiscardChanges() OVERRIDE; |
| 51 virtual void OnDecisionTimeout() OVERRIDE; |
| 52 |
| 53 private: |
| 54 friend class DeleteTask<Protector>; |
| 55 |
| 56 virtual ~Protector(); |
| 57 |
| 58 // All changes we want to show. |
| 59 SettingChangeVector changes_; |
| 60 |
| 61 // Pointer to error bubble controller. Indicates if we're showing change |
| 62 // notification to user. |
| 63 scoped_ptr<SettingsChangeGlobalError> error_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(Protector); |
| 66 }; |
| 67 |
| 68 // Shows notification about a single setting change. |
| 69 // Passes ownership of |change| to Protector instance. |
| 70 void NotifyUserOfChange(SettingChange* change); |
| 71 |
| 72 // Signs string value with protector's key. |
| 73 std::string SignSetting(const std::string& value); |
| 74 |
| 75 } // namespace protector |
| 76 |
| 77 #endif // CHROME_BROWSER_PROTECTOR_PROTECTOR_H_ |
| OLD | NEW |