Index: chrome/browser/ui/webui/options2/cookies_view_handler.h |
diff --git a/chrome/browser/ui/webui/options2/cookies_view_handler.h b/chrome/browser/ui/webui/options2/cookies_view_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5167cf6fba73021bf96e265623b29af12e09d68d |
--- /dev/null |
+++ b/chrome/browser/ui/webui/options2/cookies_view_handler.h |
@@ -0,0 +1,69 @@ |
+// 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_UI_WEBUI_OPTIONS2_COOKIES_VIEW_HANDLER_H_ |
+#define CHROME_BROWSER_UI_WEBUI_OPTIONS2_COOKIES_VIEW_HANDLER_H_ |
+#pragma once |
+ |
+#include "base/compiler_specific.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "chrome/browser/cookies_tree_model.h" |
+#include "chrome/browser/ui/webui/options2/options_ui2.h" |
+ |
+class CookiesViewHandler : public OptionsPage2UIHandler, |
+ public CookiesTreeModel::Observer { |
+ public: |
+ CookiesViewHandler(); |
+ virtual ~CookiesViewHandler(); |
+ |
+ // OptionsPage2UIHandler implementation. |
+ virtual void GetLocalizedValues( |
+ base::DictionaryValue* localized_strings) OVERRIDE; |
+ virtual void RegisterMessages() OVERRIDE; |
+ |
+ // CookiesTreeModel::Observer implementation. |
+ virtual void TreeNodesAdded(ui::TreeModel* model, |
+ ui::TreeModelNode* parent, |
+ int start, |
+ int count) OVERRIDE; |
+ virtual void TreeNodesRemoved(ui::TreeModel* model, |
+ ui::TreeModelNode* parent, |
+ int start, |
+ int count) OVERRIDE; |
+ virtual void TreeNodeChanged(ui::TreeModel* model, |
+ ui::TreeModelNode* node) OVERRIDE {} |
+ virtual void TreeModelBeginBatch(CookiesTreeModel* model) OVERRIDE; |
+ virtual void TreeModelEndBatch(CookiesTreeModel* model) OVERRIDE; |
+ |
+ private: |
+ // Creates the CookiesTreeModel if neccessary. |
+ void EnsureCookiesTreeModelCreated(); |
+ |
+ // Updates search filter for cookies tree model. |
+ void UpdateSearchResults(const base::ListValue* args); |
+ |
+ // Remove all sites data. |
+ void RemoveAll(const base::ListValue* args); |
+ |
+ // Remove selected sites data. |
+ void Remove(const base::ListValue* args); |
+ |
+ // Get the tree node using the tree path info in |args| and call |
+ // SendChildren to pass back children nodes data to WebUI. |
+ void LoadChildren(const base::ListValue* args); |
+ |
+ // Get children nodes data and pass it to 'CookiesView.loadChildren' to |
+ // update the WebUI. |
+ void SendChildren(CookieTreeNode* parent); |
+ |
+ // The Cookies Tree model |
+ scoped_ptr<CookiesTreeModel> cookies_tree_model_; |
+ |
+ // Flag to indicate whether there is a batch update in progress. |
+ bool batch_update_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CookiesViewHandler); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_COOKIES_VIEW_HANDLER_H_ |