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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/protector/protector.h
diff --git a/chrome/browser/protector/protector.h b/chrome/browser/protector/protector.h
new file mode 100644
index 0000000000000000000000000000000000000000..e6cbe395429a96c6c74d561b35ff0f03076511f5
--- /dev/null
+++ b/chrome/browser/protector/protector.h
@@ -0,0 +1,76 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PROTECTOR_PROTECTOR_H_
+#define CHROME_BROWSER_PROTECTOR_PROTECTOR_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/task.h"
+#include "chrome/browser/protector/setting_change.h"
+#include "chrome/browser/protector/settings_change_global_error.h"
+
+class GURL;
+class TemplateURLService;
+
+namespace protector {
+
+// Accumulates settings changes and shows them altogether to user.
+// Owns itself and is destroyed when user accepted or discarded changes (by
+// action or by default in case bubble and menu item are ignored).
+class Protector : public SettingsChangeGlobalError::Delegate {
+ public:
+ Protector();
+
+ // Add info about single setting change to the list of changes to notify
+ // about. Does nothing if we're showing changes already.
+ void AddChange(SettingChange* change);
+
+ // Shows error bubble to user about settings changes. The result is either
+ // accept or decline of the change.
+ void NotifyUser();
+
+ // Opens a tab with specified URL in the browser window we've shown error
+ // bubble for.
+ void OpenTab(const GURL& url);
+
+ // Returns TemplateURLService for the profile we've shown error bubble
+ // for.
+ TemplateURLService* GetTemplateURLService();
+
+ // SettingsChangeGlobalError::Delegate implementation:
+ virtual void OnApplyChanges() OVERRIDE;
+ virtual void OnDiscardChanges() OVERRIDE;
+ virtual void OnDecisionTimeout() OVERRIDE;
+
+ private:
+ friend class DeleteTask<Protector>;
+
+ ~Protector();
+
+ // All changes we want to show.
+ SettingChangeVector changes_;
+
+ // Pointer to error bubble controller. Indicates if we're showing change
+ // notification to user.
+ scoped_ptr<SettingsChangeGlobalError> error_;
+
+ DISALLOW_COPY_AND_ASSIGN(Protector);
+};
+
+// Shows notification about a single setting change.
+// Passes ownership of |change| to Protector instance.
+void NotifyUserOfChange(SettingChange* change);
+
+// Signs string value with protector's key.
+std::string SignSetting(const std::string& value);
+
+} // namespace protector
+
+#endif // CHROME_BROWSER_PROTECTOR_PROTECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698