Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/protector/protector.h

Issue 8342049: Added Protector, hooked up DSE verification with error bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved changes in separate files. Simplified objects ownership. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698