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_UI_WEBUI_OPTIONS2_COOKIES_VIEW_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_COOKIES_VIEW_HANDLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/cookies_tree_model.h" |
| 12 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
| 13 |
| 14 class CookiesViewHandler : public OptionsPage2UIHandler, |
| 15 public CookiesTreeModel::Observer { |
| 16 public: |
| 17 CookiesViewHandler(); |
| 18 virtual ~CookiesViewHandler(); |
| 19 |
| 20 // OptionsPage2UIHandler implementation. |
| 21 virtual void GetLocalizedValues( |
| 22 base::DictionaryValue* localized_strings) OVERRIDE; |
| 23 virtual void RegisterMessages() OVERRIDE; |
| 24 |
| 25 // CookiesTreeModel::Observer implementation. |
| 26 virtual void TreeNodesAdded(ui::TreeModel* model, |
| 27 ui::TreeModelNode* parent, |
| 28 int start, |
| 29 int count) OVERRIDE; |
| 30 virtual void TreeNodesRemoved(ui::TreeModel* model, |
| 31 ui::TreeModelNode* parent, |
| 32 int start, |
| 33 int count) OVERRIDE; |
| 34 virtual void TreeNodeChanged(ui::TreeModel* model, |
| 35 ui::TreeModelNode* node) OVERRIDE {} |
| 36 virtual void TreeModelBeginBatch(CookiesTreeModel* model) OVERRIDE; |
| 37 virtual void TreeModelEndBatch(CookiesTreeModel* model) OVERRIDE; |
| 38 |
| 39 private: |
| 40 // Creates the CookiesTreeModel if neccessary. |
| 41 void EnsureCookiesTreeModelCreated(); |
| 42 |
| 43 // Updates search filter for cookies tree model. |
| 44 void UpdateSearchResults(const base::ListValue* args); |
| 45 |
| 46 // Remove all sites data. |
| 47 void RemoveAll(const base::ListValue* args); |
| 48 |
| 49 // Remove selected sites data. |
| 50 void Remove(const base::ListValue* args); |
| 51 |
| 52 // Get the tree node using the tree path info in |args| and call |
| 53 // SendChildren to pass back children nodes data to WebUI. |
| 54 void LoadChildren(const base::ListValue* args); |
| 55 |
| 56 // Get children nodes data and pass it to 'CookiesView.loadChildren' to |
| 57 // update the WebUI. |
| 58 void SendChildren(CookieTreeNode* parent); |
| 59 |
| 60 // The Cookies Tree model |
| 61 scoped_ptr<CookiesTreeModel> cookies_tree_model_; |
| 62 |
| 63 // Flag to indicate whether there is a batch update in progress. |
| 64 bool batch_update_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(CookiesViewHandler); |
| 67 }; |
| 68 |
| 69 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_COOKIES_VIEW_HANDLER_H_ |
OLD | NEW |