| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 11 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 12 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 12 #import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h" | 13 #import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h" |
| 13 #import "chrome/browser/ui/cocoa/content_settings/cookies_tree_controller_bridge
.h" | 14 #import "chrome/browser/ui/cocoa/content_settings/cookies_tree_controller_bridge
.h" |
| 14 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 16 | 17 |
| 17 @class CollectedCookiesWindowController; | 18 @class CollectedCookiesWindowController; |
| 18 @class CookieDetailsViewController; | 19 @class CookieDetailsViewController; |
| 19 @class VerticalGradientView; | 20 @class VerticalGradientView; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 } | 41 } |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 // NotificationObserver implementation. | 44 // NotificationObserver implementation. |
| 44 void Observe(int type, | 45 void Observe(int type, |
| 45 const content::NotificationSource& source, | 46 const content::NotificationSource& source, |
| 46 const content::NotificationDetails& details) override; | 47 const content::NotificationDetails& details) override; |
| 47 | 48 |
| 48 content::NotificationRegistrar registrar_; | 49 content::NotificationRegistrar registrar_; |
| 49 | 50 |
| 50 scoped_ptr<ConstrainedWindowMac> window_; | 51 std::unique_ptr<ConstrainedWindowMac> window_; |
| 51 | 52 |
| 52 base::scoped_nsobject<CollectedCookiesWindowController> sheet_controller_; | 53 base::scoped_nsobject<CollectedCookiesWindowController> sheet_controller_; |
| 53 | 54 |
| 54 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesMac); | 55 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesMac); |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 // Controller for the collected cookies dialog. This class stores an internal | 58 // Controller for the collected cookies dialog. This class stores an internal |
| 58 // copy of the CookiesTreeModel but with Cocoa-converted values (NSStrings and | 59 // copy of the CookiesTreeModel but with Cocoa-converted values (NSStrings and |
| 59 // NSImages instead of std::strings and ImageSkias). Doing this allows us to use | 60 // NSImages instead of std::strings and ImageSkias). Doing this allows us to use |
| 60 // bindings for the interface. Changes are pushed to this internal model via a | 61 // bindings for the interface. Changes are pushed to this internal model via a |
| 61 // very thin bridge (see cookies_window_controller.h). | 62 // very thin bridge (see cookies_window_controller.h). |
| 62 @interface CollectedCookiesWindowController : NSWindowController | 63 @interface CollectedCookiesWindowController : NSWindowController |
| 63 <NSOutlineViewDelegate, | 64 <NSOutlineViewDelegate, |
| 64 NSTabViewDelegate, | 65 NSTabViewDelegate, |
| 65 NSWindowDelegate> { | 66 NSWindowDelegate> { |
| 66 @private | 67 @private |
| 67 // Platform-independent model. | 68 // Platform-independent model. |
| 68 scoped_ptr<CookiesTreeModel> allowedTreeModel_; | 69 std::unique_ptr<CookiesTreeModel> allowedTreeModel_; |
| 69 scoped_ptr<CookiesTreeModel> blockedTreeModel_; | 70 std::unique_ptr<CookiesTreeModel> blockedTreeModel_; |
| 70 | 71 |
| 71 // Cached array of icons. | 72 // Cached array of icons. |
| 72 base::scoped_nsobject<NSMutableArray> icons_; | 73 base::scoped_nsobject<NSMutableArray> icons_; |
| 73 | 74 |
| 74 // Our Cocoa copy of the model. | 75 // Our Cocoa copy of the model. |
| 75 scoped_ptr<CookiesTreeControllerBridge> allowedControllerBridge_; | 76 std::unique_ptr<CookiesTreeControllerBridge> allowedControllerBridge_; |
| 76 scoped_ptr<CookiesTreeControllerBridge> blockedControllerBridge_; | 77 std::unique_ptr<CookiesTreeControllerBridge> blockedControllerBridge_; |
| 77 | 78 |
| 78 BOOL allowedCookiesButtonsEnabled_; | 79 BOOL allowedCookiesButtonsEnabled_; |
| 79 BOOL blockedCookiesButtonsEnabled_; | 80 BOOL blockedCookiesButtonsEnabled_; |
| 80 BOOL deleteCookiesButtonEnabled_; // Only in the allowed pane. | 81 BOOL deleteCookiesButtonEnabled_; // Only in the allowed pane. |
| 81 | 82 |
| 82 IBOutlet NSTreeController* allowedTreeController_; | 83 IBOutlet NSTreeController* allowedTreeController_; |
| 83 IBOutlet NSTreeController* blockedTreeController_; | 84 IBOutlet NSTreeController* blockedTreeController_; |
| 84 IBOutlet NSOutlineView* allowedOutlineView_; | 85 IBOutlet NSOutlineView* allowedOutlineView_; |
| 85 IBOutlet NSOutlineView* blockedOutlineView_; | 86 IBOutlet NSOutlineView* blockedOutlineView_; |
| 86 IBOutlet VerticalGradientView* infoBar_; | 87 IBOutlet VerticalGradientView* infoBar_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 - (CookiesTreeModel*)allowedTreeModel; | 143 - (CookiesTreeModel*)allowedTreeModel; |
| 143 - (CookiesTreeModel*)blockedTreeModel; | 144 - (CookiesTreeModel*)blockedTreeModel; |
| 144 | 145 |
| 145 - (void)loadTreeModelFromWebContents; | 146 - (void)loadTreeModelFromWebContents; |
| 146 | 147 |
| 147 // Given an array of selected NSTreeNode objects, normalizes the selection so | 148 // Given an array of selected NSTreeNode objects, normalizes the selection so |
| 148 // that it does not contain any children whose parents are also in the array. | 149 // that it does not contain any children whose parents are also in the array. |
| 149 + (NSArray*)normalizeNodeSelection:(NSArray*)selection; | 150 + (NSArray*)normalizeNodeSelection:(NSArray*)selection; |
| 150 | 151 |
| 151 @end | 152 @end |
| OLD | NEW |