Chromium Code Reviews| 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 "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 9 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 10 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | |
| 11 #import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h" | 10 #import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h" |
| 12 #import "chrome/browser/ui/cocoa/content_settings/cookies_tree_controller_bridge .h" | 11 #import "chrome/browser/ui/cocoa/content_settings/cookies_tree_controller_bridge .h" |
| 13 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 15 | 14 |
| 16 @class CollectedCookiesWindowController; | 15 @class CollectedCookiesWindowController; |
| 17 @class CookieDetailsViewController; | 16 @class CookieDetailsViewController; |
| 18 @class VerticalGradientView; | 17 @class VerticalGradientView; |
| 19 | 18 |
| 20 namespace content { | 19 namespace content { |
| 21 class WebContents; | 20 class WebContents; |
| 22 } | 21 } |
| 23 | 22 |
| 24 // The constrained window delegate reponsible for managing the collected | 23 // Reponsible for managing the collected cookies dialog. |
| 25 // cookies dialog. | 24 class CollectedCookiesMac : public content::NotificationObserver { |
| 26 class CollectedCookiesMac : public ConstrainedWindowMacDelegate, | |
| 27 public content::NotificationObserver { | |
| 28 public: | 25 public: |
| 29 CollectedCookiesMac(content::WebContents* web_contents); | 26 CollectedCookiesMac(content::WebContents* web_contents); |
| 30 ~CollectedCookiesMac() override; | 27 ~CollectedCookiesMac() override; |
| 31 | 28 |
| 32 void PerformClose(); | 29 void PerformClose(); |
| 33 | 30 |
| 34 // ConstrainedWindowMacDelegate implementation. | |
| 35 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; | |
| 36 | |
| 37 CollectedCookiesWindowController* sheet_controller() const { | 31 CollectedCookiesWindowController* sheet_controller() const { |
| 38 return sheet_controller_.get(); | 32 return sheet_controller_.get(); |
| 39 } | 33 } |
| 40 | 34 |
| 41 private: | 35 private: |
| 42 // NotificationObserver implementation. | 36 // NotificationObserver implementation. |
| 43 void Observe(int type, | 37 void Observe(int type, |
| 44 const content::NotificationSource& source, | 38 const content::NotificationSource& source, |
| 45 const content::NotificationDetails& details) override; | 39 const content::NotificationDetails& details) override; |
| 46 | 40 |
| 41 content::WebContents* web_contents_; // weak | |
|
tapted
2015/02/25 06:23:28
This weak reference spooks me out a little. It's n
| |
| 47 content::NotificationRegistrar registrar_; | 42 content::NotificationRegistrar registrar_; |
| 48 | 43 |
| 49 scoped_ptr<ConstrainedWindowMac> window_; | |
| 50 | |
| 51 base::scoped_nsobject<CollectedCookiesWindowController> sheet_controller_; | 44 base::scoped_nsobject<CollectedCookiesWindowController> sheet_controller_; |
| 52 | 45 |
| 53 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesMac); | 46 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesMac); |
| 54 }; | 47 }; |
| 55 | 48 |
| 56 // Controller for the collected cookies dialog. This class stores an internal | 49 // Controller for the collected cookies dialog. This class stores an internal |
| 57 // copy of the CookiesTreeModel but with Cocoa-converted values (NSStrings and | 50 // copy of the CookiesTreeModel but with Cocoa-converted values (NSStrings and |
| 58 // NSImages instead of std::strings and ImageSkias). Doing this allows us to use | 51 // NSImages instead of std::strings and ImageSkias). Doing this allows us to use |
| 59 // bindings for the interface. Changes are pushed to this internal model via a | 52 // bindings for the interface. Changes are pushed to this internal model via a |
| 60 // very thin bridge (see cookies_window_controller.h). | 53 // very thin bridge (see cookies_window_controller.h). |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 - (CookiesTreeModel*)allowedTreeModel; | 134 - (CookiesTreeModel*)allowedTreeModel; |
| 142 - (CookiesTreeModel*)blockedTreeModel; | 135 - (CookiesTreeModel*)blockedTreeModel; |
| 143 | 136 |
| 144 - (void)loadTreeModelFromWebContents; | 137 - (void)loadTreeModelFromWebContents; |
| 145 | 138 |
| 146 // Given an array of selected NSTreeNode objects, normalizes the selection so | 139 // Given an array of selected NSTreeNode objects, normalizes the selection so |
| 147 // that it does not contain any children whose parents are also in the array. | 140 // that it does not contain any children whose parents are also in the array. |
| 148 + (NSArray*)normalizeNodeSelection:(NSArray*)selection; | 141 + (NSArray*)normalizeNodeSelection:(NSArray*)selection; |
| 149 | 142 |
| 150 @end | 143 @end |
| OLD | NEW |