| 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 "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/task.h" |
| 13 #include "chrome/browser/protector/setting_change.h" |
| 14 #include "chrome/browser/protector/settings_change_global_error_delegate.h" |
| 15 |
| 16 class GURL; |
| 17 class Profile; |
| 18 class TemplateURLService; |
| 19 |
| 20 namespace protector { |
| 21 |
| 22 class SettingsChangeGlobalError; |
| 23 |
| 24 // Accumulates settings changes and shows them altogether to user. |
| 25 // Deletes itself when changes are shown to the user and some action is taken |
| 26 // or timeout expires. |
| 27 class Protector : public SettingsChangeGlobalErrorDelegate { |
| 28 public: |
| 29 explicit Protector(Profile* profile); |
| 30 |
| 31 // Opens a tab with specified URL in the browser window we've shown error |
| 32 // bubble for. |
| 33 void OpenTab(const GURL& url); |
| 34 |
| 35 // Returns TemplateURLService for the profile we've shown error bubble |
| 36 // for. |
| 37 TemplateURLService* GetTemplateURLService(); |
| 38 |
| 39 // Shows global error about the specified change. Ownership of the change |
| 40 // is passed to the error object. |
| 41 void ShowChange(SettingChange* change); |
| 42 |
| 43 // SettingsChangeGlobalErrorDelegate implementation. |
| 44 virtual void OnApplyChanges() OVERRIDE; |
| 45 virtual void OnDiscardChanges() OVERRIDE; |
| 46 virtual void OnDecisionTimeout() OVERRIDE; |
| 47 |
| 48 private: |
| 49 friend class DeleteTask<Protector>; |
| 50 |
| 51 // The object can only be allocated and destroyed on heap. |
| 52 virtual ~Protector(); |
| 53 |
| 54 // Common handler for error delegate handlers. Calls the specified method |
| 55 // on each change we showed error for. |
| 56 void OnChangesAction(SettingChangeAction action); |
| 57 |
| 58 // Pointer to error bubble controller. Indicates if we're showing change |
| 59 // notification to user. Owns itself. |
| 60 scoped_ptr<SettingsChangeGlobalError> error_; |
| 61 |
| 62 // Profile which settings we are protecting. |
| 63 Profile* profile_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(Protector); |
| 66 }; |
| 67 |
| 68 // Signs string value with protector's key. |
| 69 std::string SignSetting(const std::string& value); |
| 70 |
| 71 } // namespace protector |
| 72 |
| 73 #endif // CHROME_BROWSER_PROTECTOR_PROTECTOR_H_ |
| OLD | NEW |