[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / content_settings / cookies_tree_controller_bridge.h
blobdb6c606353ec294e76e674ce270a4a8a15e67912
1 // Copyright 2014 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_COCOA_CONTENT_SETTINGS_COOKIES_TREE_CONTROLLER_BRIDGE_H_
6 #define CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIES_TREE_CONTROLLER_BRIDGE_H_
8 #import <Cocoa/Cocoa.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/browsing_data/cookies_tree_model.h"
12 #import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h"
14 class CookiesTreeControllerBridge : public ui::TreeModelObserver {
15 public:
16 explicit CookiesTreeControllerBridge(CookiesTreeModel* model);
17 virtual ~CookiesTreeControllerBridge();
19 // TreeModelObserver:
20 virtual void TreeNodesAdded(ui::TreeModel* model,
21 ui::TreeModelNode* parent,
22 int start,
23 int count) OVERRIDE;
24 virtual void TreeNodesRemoved(ui::TreeModel* model,
25 ui::TreeModelNode* parent,
26 int start,
27 int count) OVERRIDE;
28 virtual void TreeNodeChanged(ui::TreeModel* model,
29 ui::TreeModelNode* node) OVERRIDE;
31 CocoaCookieTreeNode* cocoa_model() const { return cocoa_model_.get(); }
33 private:
34 // Creates a CocoaCookieTreeNode from a platform-independent one.
35 // Return value is autoreleased. This creates child nodes recusively.
36 CocoaCookieTreeNode* CocoaNodeFromTreeNode(ui::TreeModelNode* node);
38 // Finds the Cocoa model node based on a platform-independent one. This is
39 // done by comparing the treeNode pointers. |start| is the node to start
40 // searching at. If |start| is nil, the root is used.
41 CocoaCookieTreeNode* FindCocoaNode(ui::TreeModelNode* node,
42 CocoaCookieTreeNode* start);
44 // The C++ model that this observes.
45 CookiesTreeModel* model_; // weak
47 // A copy of the model using Cocoa objects instead of C++ ones.
48 base::scoped_nsobject<CocoaCookieTreeNode> cocoa_model_;
51 #endif // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIES_TREE_CONTROLLER_BRIDGE_H_