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