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