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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_COOKIES_VIEW_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_COOKIES_VIEW_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/browsing_data/cookies_tree_model.h"
11 #include "chrome/browser/ui/webui/options/options_ui.h"
13 class CookiesTreeModelUtil
;
17 class CookiesViewHandler
: public OptionsPageUIHandler
,
18 public CookiesTreeModel::Observer
{
21 ~CookiesViewHandler() override
;
23 // OptionsPageUIHandler implementation.
24 void GetLocalizedValues(base::DictionaryValue
* localized_strings
) override
;
25 void RegisterMessages() override
;
27 // CookiesTreeModel::Observer implementation.
28 void TreeNodesAdded(ui::TreeModel
* model
,
29 ui::TreeModelNode
* parent
,
32 void TreeNodesRemoved(ui::TreeModel
* model
,
33 ui::TreeModelNode
* parent
,
36 void TreeNodeChanged(ui::TreeModel
* model
, ui::TreeModelNode
* node
) override
{
38 void TreeModelBeginBatch(CookiesTreeModel
* model
) override
;
39 void TreeModelEndBatch(CookiesTreeModel
* model
) override
;
42 // Creates the CookiesTreeModel if neccessary.
43 void EnsureCookiesTreeModelCreated();
45 // Updates search filter for cookies tree model.
46 void UpdateSearchResults(const base::ListValue
* args
);
48 // Remove all sites data.
49 void RemoveAll(const base::ListValue
* args
);
51 // Remove selected sites data.
52 void Remove(const base::ListValue
* args
);
54 // Get the tree node using the tree path info in |args| and call
55 // SendChildren to pass back children nodes data to WebUI.
56 void LoadChildren(const base::ListValue
* args
);
58 // Get children nodes data and pass it to 'CookiesView.loadChildren' to
60 void SendChildren(const CookieTreeNode
* parent
);
62 // Reloads the CookiesTreeModel and passes the nodes to
63 // 'CookiesView.loadChildren' to update the WebUI.
64 void ReloadCookies(const base::ListValue
* args
);
66 // The Cookies Tree model
67 scoped_ptr
<CookiesTreeModel
> cookies_tree_model_
;
69 // Flag to indicate whether there is a batch update in progress.
72 scoped_ptr
<CookiesTreeModelUtil
> model_util_
;
74 DISALLOW_COPY_AND_ASSIGN(CookiesViewHandler
);
77 } // namespace options
79 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_COOKIES_VIEW_HANDLER_H_