Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / cookies_view_handler.h
blobb80c5b8c10e44d699a8ccdd296d87fed71dd997f
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;
15 namespace options {
17 class CookiesViewHandler : public OptionsPageUIHandler,
18 public CookiesTreeModel::Observer {
19 public:
20 CookiesViewHandler();
21 virtual ~CookiesViewHandler();
23 // OptionsPageUIHandler implementation.
24 virtual void GetLocalizedValues(
25 base::DictionaryValue* localized_strings) override;
26 virtual void RegisterMessages() override;
28 // CookiesTreeModel::Observer implementation.
29 virtual void TreeNodesAdded(ui::TreeModel* model,
30 ui::TreeModelNode* parent,
31 int start,
32 int count) override;
33 virtual void TreeNodesRemoved(ui::TreeModel* model,
34 ui::TreeModelNode* parent,
35 int start,
36 int count) override;
37 virtual void TreeNodeChanged(ui::TreeModel* model,
38 ui::TreeModelNode* node) override {}
39 virtual void TreeModelBeginBatch(CookiesTreeModel* model) override;
40 virtual void TreeModelEndBatch(CookiesTreeModel* model) override;
42 private:
43 // Creates the CookiesTreeModel if neccessary.
44 void EnsureCookiesTreeModelCreated();
46 // Updates search filter for cookies tree model.
47 void UpdateSearchResults(const base::ListValue* args);
49 // Remove all sites data.
50 void RemoveAll(const base::ListValue* args);
52 // Remove selected sites data.
53 void Remove(const base::ListValue* args);
55 // Get the tree node using the tree path info in |args| and call
56 // SendChildren to pass back children nodes data to WebUI.
57 void LoadChildren(const base::ListValue* args);
59 // Get children nodes data and pass it to 'CookiesView.loadChildren' to
60 // update the WebUI.
61 void SendChildren(const CookieTreeNode* parent);
63 // Reloads the CookiesTreeModel and passes the nodes to
64 // 'CookiesView.loadChildren' to update the WebUI.
65 void ReloadCookies(const base::ListValue* args);
67 // The Cookies Tree model
68 scoped_ptr<CookiesTreeModel> cookies_tree_model_;
70 // Flag to indicate whether there is a batch update in progress.
71 bool batch_update_;
73 scoped_ptr<CookiesTreeModelUtil> model_util_;
75 DISALLOW_COPY_AND_ASSIGN(CookiesViewHandler);
78 } // namespace options
80 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_COOKIES_VIEW_HANDLER_H_