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