OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "base/mac/cocoa_protocols.h" | 7 #import "base/mac/cocoa_protocols.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/cookies_tree_model.h" | 10 #include "chrome/browser/cookies_tree_model.h" |
11 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" | 11 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" |
12 #import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h" | 12 #import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h" |
13 #include "content/common/notification_registrar.h" | 13 #include "content/common/notification_registrar.h" |
14 | 14 |
15 @class CollectedCookiesWindowController; | 15 @class CollectedCookiesWindowController; |
16 @class CookieDetailsViewController; | 16 @class CookieDetailsViewController; |
17 @class VerticalGradientView; | 17 @class VerticalGradientView; |
18 class TabContents; | 18 class TabContentsWrapper; |
19 | 19 |
20 // The constrained window delegate reponsible for managing the collected | 20 // The constrained window delegate reponsible for managing the collected |
21 // cookies dialog. | 21 // cookies dialog. |
22 class CollectedCookiesMac : public ConstrainedWindowMacDelegateCustomSheet, | 22 class CollectedCookiesMac : public ConstrainedWindowMacDelegateCustomSheet, |
23 public NotificationObserver { | 23 public NotificationObserver { |
24 public: | 24 public: |
25 CollectedCookiesMac(NSWindow* parent, TabContents* tab_contents); | 25 CollectedCookiesMac(NSWindow* parent, TabContentsWrapper* wrapper); |
26 | 26 |
27 void OnSheetDidEnd(NSWindow* sheet); | 27 void OnSheetDidEnd(NSWindow* sheet); |
28 | 28 |
29 // ConstrainedWindowMacDelegateCustomSheet implementation. | 29 // ConstrainedWindowMacDelegateCustomSheet implementation. |
30 virtual void DeleteDelegate(); | 30 virtual void DeleteDelegate(); |
31 | 31 |
32 private: | 32 private: |
33 virtual ~CollectedCookiesMac(); | 33 virtual ~CollectedCookiesMac(); |
34 | 34 |
35 // NotificationObserver implementation. | 35 // NotificationObserver implementation. |
36 virtual void Observe(int type, | 36 virtual void Observe(int type, |
37 const NotificationSource& source, | 37 const NotificationSource& source, |
38 const NotificationDetails& details); | 38 const NotificationDetails& details); |
39 | 39 |
40 NotificationRegistrar registrar_; | 40 NotificationRegistrar registrar_; |
41 | 41 |
42 ConstrainedWindow* window_; | 42 ConstrainedWindow* window_; |
43 | 43 |
44 TabContents* tab_contents_; | |
45 | |
46 CollectedCookiesWindowController* sheet_controller_; | 44 CollectedCookiesWindowController* sheet_controller_; |
47 | 45 |
48 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesMac); | 46 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesMac); |
49 }; | 47 }; |
50 | 48 |
51 // Controller for the collected cookies dialog. This class stores an internal | 49 // Controller for the collected cookies dialog. This class stores an internal |
52 // copy of the CookiesTreeModel but with Cocoa-converted values (NSStrings and | 50 // copy of the CookiesTreeModel but with Cocoa-converted values (NSStrings and |
53 // NSImages instead of std::strings and SkBitmaps). Doing this allows us to use | 51 // NSImages instead of std::strings and SkBitmaps). Doing this allows us to use |
54 // 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 |
55 // very thin bridge (see cookies_window_controller.h). | 53 // very thin bridge (see cookies_window_controller.h). |
(...skipping 25 matching lines...) Expand all Loading... |
81 IBOutlet NSTextField* infoBarText_; | 79 IBOutlet NSTextField* infoBarText_; |
82 IBOutlet NSTabView* tabView_; | 80 IBOutlet NSTabView* tabView_; |
83 IBOutlet NSScrollView* blockedScrollView_; | 81 IBOutlet NSScrollView* blockedScrollView_; |
84 IBOutlet NSTextField* blockedCookiesText_; | 82 IBOutlet NSTextField* blockedCookiesText_; |
85 IBOutlet NSView* cookieDetailsViewPlaceholder_; | 83 IBOutlet NSView* cookieDetailsViewPlaceholder_; |
86 | 84 |
87 scoped_nsobject<NSViewAnimation> animation_; | 85 scoped_nsobject<NSViewAnimation> animation_; |
88 | 86 |
89 scoped_nsobject<CookieDetailsViewController> detailsViewController_; | 87 scoped_nsobject<CookieDetailsViewController> detailsViewController_; |
90 | 88 |
91 TabContents* tabContents_; // weak | 89 TabContentsWrapper* wrapper_; // weak |
92 | 90 |
93 BOOL infoBarVisible_; | 91 BOOL infoBarVisible_; |
94 | 92 |
95 BOOL contentSettingsChanged_; | 93 BOOL contentSettingsChanged_; |
96 } | 94 } |
97 @property(readonly, nonatomic) NSTreeController* allowedTreeController; | 95 @property(readonly, nonatomic) NSTreeController* allowedTreeController; |
98 @property(readonly, nonatomic) NSTreeController* blockedTreeController; | 96 @property(readonly, nonatomic) NSTreeController* blockedTreeController; |
99 | 97 |
100 @property(assign, nonatomic) BOOL allowedCookiesButtonsEnabled; | 98 @property(assign, nonatomic) BOOL allowedCookiesButtonsEnabled; |
101 @property(assign, nonatomic) BOOL blockedCookiesButtonsEnabled; | 99 @property(assign, nonatomic) BOOL blockedCookiesButtonsEnabled; |
102 | 100 |
103 // Designated initializer. TabContents cannot be NULL. | 101 // Designated initializer. TabContents cannot be NULL. |
104 - (id)initWithTabContents:(TabContents*)tabContents; | 102 - (id)initWithTabContentsWrapper:(TabContentsWrapper*)wrapper; |
105 | 103 |
106 // Closes the sheet and ends the modal loop. This will also cleanup the memory. | 104 // Closes the sheet and ends the modal loop. This will also cleanup the memory. |
107 - (IBAction)closeSheet:(id)sender; | 105 - (IBAction)closeSheet:(id)sender; |
108 | 106 |
109 - (IBAction)allowOrigin:(id)sender; | 107 - (IBAction)allowOrigin:(id)sender; |
110 - (IBAction)allowForSessionFromOrigin:(id)sender; | 108 - (IBAction)allowForSessionFromOrigin:(id)sender; |
111 - (IBAction)blockOrigin:(id)sender; | 109 - (IBAction)blockOrigin:(id)sender; |
112 | 110 |
113 // Returns the |cocoaAllowedTreeModel_| and |cocoaBlockedTreeModel_|. | 111 // Returns the |cocoaAllowedTreeModel_| and |cocoaBlockedTreeModel_|. |
114 - (CocoaCookieTreeNode*)cocoaAllowedTreeModel; | 112 - (CocoaCookieTreeNode*)cocoaAllowedTreeModel; |
115 - (CocoaCookieTreeNode*)cocoaBlockedTreeModel; | 113 - (CocoaCookieTreeNode*)cocoaBlockedTreeModel; |
116 - (void)setCocoaAllowedTreeModel:(CocoaCookieTreeNode*)model; | 114 - (void)setCocoaAllowedTreeModel:(CocoaCookieTreeNode*)model; |
117 - (void)setCocoaBlockedTreeModel:(CocoaCookieTreeNode*)model; | 115 - (void)setCocoaBlockedTreeModel:(CocoaCookieTreeNode*)model; |
118 | 116 |
119 // Returns the |allowedTreeModel_| and |blockedTreeModel_|. | 117 // Returns the |allowedTreeModel_| and |blockedTreeModel_|. |
120 - (CookiesTreeModel*)allowedTreeModel; | 118 - (CookiesTreeModel*)allowedTreeModel; |
121 - (CookiesTreeModel*)blockedTreeModel; | 119 - (CookiesTreeModel*)blockedTreeModel; |
122 | 120 |
123 - (void)loadTreeModelFromTabContents; | 121 - (void)loadTreeModelFromTabContentsWrapper; |
124 @end | 122 @end |
OLD | NEW |