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 "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" | 5 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #import "base/mac/mac_util.h" | 9 #import "base/mac/mac_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #include "chrome/browser/content_settings/host_content_settings_map.h" | 11 #include "chrome/browser/content_settings/host_content_settings_map.h" |
12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #import "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller
.h" | 14 #import "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller
.h" |
15 #import "chrome/browser/ui/cocoa/vertical_gradient_view.h" | 15 #import "chrome/browser/ui/cocoa/vertical_gradient_view.h" |
16 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 16 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 18 #include "chrome/common/chrome_notification_types.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
19 #include "content/common/notification_details.h" | 20 #include "content/common/notification_details.h" |
20 #include "content/common/notification_source.h" | 21 #include "content/common/notification_source.h" |
21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
22 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
23 #include "skia/ext/skia_utils_mac.h" | 24 #include "skia/ext/skia_utils_mac.h" |
24 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 25 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
25 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 26 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
26 #include "third_party/apple/ImageAndTextCell.h" | 27 #include "third_party/apple/ImageAndTextCell.h" |
27 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 CollectedCookiesMac::CollectedCookiesMac(NSWindow* parent, | 78 CollectedCookiesMac::CollectedCookiesMac(NSWindow* parent, |
78 TabContents* tab_contents) | 79 TabContents* tab_contents) |
79 : ConstrainedWindowMacDelegateCustomSheet( | 80 : ConstrainedWindowMacDelegateCustomSheet( |
80 [[[CollectedCookiesSheetBridge alloc] | 81 [[[CollectedCookiesSheetBridge alloc] |
81 initWithCollectedCookiesMac:this] autorelease], | 82 initWithCollectedCookiesMac:this] autorelease], |
82 @selector(sheetDidEnd:returnCode:contextInfo:)), | 83 @selector(sheetDidEnd:returnCode:contextInfo:)), |
83 tab_contents_(tab_contents) { | 84 tab_contents_(tab_contents) { |
84 TabSpecificContentSettings* content_settings = | 85 TabSpecificContentSettings* content_settings = |
85 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> | 86 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> |
86 content_settings(); | 87 content_settings(); |
87 registrar_.Add(this, NotificationType::COLLECTED_COOKIES_SHOWN, | 88 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, |
88 Source<TabSpecificContentSettings>(content_settings)); | 89 Source<TabSpecificContentSettings>(content_settings)); |
89 | 90 |
90 sheet_controller_ = [[CollectedCookiesWindowController alloc] | 91 sheet_controller_ = [[CollectedCookiesWindowController alloc] |
91 initWithTabContents:tab_contents]; | 92 initWithTabContents:tab_contents]; |
92 | 93 |
93 set_sheet([sheet_controller_ window]); | 94 set_sheet([sheet_controller_ window]); |
94 | 95 |
95 window_ = tab_contents->CreateConstrainedDialog(this); | 96 window_ = tab_contents->CreateConstrainedDialog(this); |
96 } | 97 } |
97 | 98 |
98 CollectedCookiesMac::~CollectedCookiesMac() { | 99 CollectedCookiesMac::~CollectedCookiesMac() { |
99 NSWindow* window = [sheet_controller_ window]; | 100 NSWindow* window = [sheet_controller_ window]; |
100 if (window_ && window && is_sheet_open()) { | 101 if (window_ && window && is_sheet_open()) { |
101 window_ = NULL; | 102 window_ = NULL; |
102 [NSApp endSheet:window]; | 103 [NSApp endSheet:window]; |
103 } | 104 } |
104 } | 105 } |
105 | 106 |
106 void CollectedCookiesMac::DeleteDelegate() { | 107 void CollectedCookiesMac::DeleteDelegate() { |
107 delete this; | 108 delete this; |
108 } | 109 } |
109 | 110 |
110 void CollectedCookiesMac::Observe(NotificationType type, | 111 void CollectedCookiesMac::Observe(int type, |
111 const NotificationSource& source, | 112 const NotificationSource& source, |
112 const NotificationDetails& details) { | 113 const NotificationDetails& details) { |
113 DCHECK(type == NotificationType::COLLECTED_COOKIES_SHOWN); | 114 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); |
114 window_->CloseConstrainedWindow(); | 115 window_->CloseConstrainedWindow(); |
115 } | 116 } |
116 | 117 |
117 void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { | 118 void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { |
118 [sheet orderOut:sheet_controller_]; | 119 [sheet orderOut:sheet_controller_]; |
119 if (window_) | 120 if (window_) |
120 window_->CloseConstrainedWindow(); | 121 window_->CloseConstrainedWindow(); |
121 } | 122 } |
122 | 123 |
123 #pragma mark Window Controller | 124 #pragma mark Window Controller |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 treeController = blockedTreeController_; | 508 treeController = blockedTreeController_; |
508 break; | 509 break; |
509 default: | 510 default: |
510 NOTREACHED(); | 511 NOTREACHED(); |
511 return; | 512 return; |
512 } | 513 } |
513 [detailsViewController_ configureBindingsForTreeController:treeController]; | 514 [detailsViewController_ configureBindingsForTreeController:treeController]; |
514 } | 515 } |
515 | 516 |
516 @end | 517 @end |
OLD | NEW |