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