| 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" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 CollectedCookiesMac::CollectedCookiesMac(NSWindow* parent, | 77 CollectedCookiesMac::CollectedCookiesMac(NSWindow* parent, |
| 78 TabContents* tab_contents) | 78 TabContents* tab_contents) |
| 79 : ConstrainedWindowMacDelegateCustomSheet( | 79 : ConstrainedWindowMacDelegateCustomSheet( |
| 80 [[[CollectedCookiesSheetBridge alloc] | 80 [[[CollectedCookiesSheetBridge alloc] |
| 81 initWithCollectedCookiesMac:this] autorelease], | 81 initWithCollectedCookiesMac:this] autorelease], |
| 82 @selector(sheetDidEnd:returnCode:contextInfo:)), | 82 @selector(sheetDidEnd:returnCode:contextInfo:)), |
| 83 tab_contents_(tab_contents) { | 83 tab_contents_(tab_contents) { |
| 84 TabSpecificContentSettings* content_settings = | 84 TabSpecificContentSettings* content_settings = |
| 85 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> | 85 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> |
| 86 content_settings(); | 86 content_settings(); |
| 87 registrar_.Add(this, NotificationType::COLLECTED_COOKIES_SHOWN, | 87 registrar_.Add(this, chrome::COLLECTED_COOKIES_SHOWN, |
| 88 Source<TabSpecificContentSettings>(content_settings)); | 88 Source<TabSpecificContentSettings>(content_settings)); |
| 89 | 89 |
| 90 sheet_controller_ = [[CollectedCookiesWindowController alloc] | 90 sheet_controller_ = [[CollectedCookiesWindowController alloc] |
| 91 initWithTabContents:tab_contents]; | 91 initWithTabContents:tab_contents]; |
| 92 | 92 |
| 93 set_sheet([sheet_controller_ window]); | 93 set_sheet([sheet_controller_ window]); |
| 94 | 94 |
| 95 window_ = tab_contents->CreateConstrainedDialog(this); | 95 window_ = tab_contents->CreateConstrainedDialog(this); |
| 96 } | 96 } |
| 97 | 97 |
| 98 CollectedCookiesMac::~CollectedCookiesMac() { | 98 CollectedCookiesMac::~CollectedCookiesMac() { |
| 99 NSWindow* window = [sheet_controller_ window]; | 99 NSWindow* window = [sheet_controller_ window]; |
| 100 if (window_ && window && is_sheet_open()) { | 100 if (window_ && window && is_sheet_open()) { |
| 101 window_ = NULL; | 101 window_ = NULL; |
| 102 [NSApp endSheet:window]; | 102 [NSApp endSheet:window]; |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 void CollectedCookiesMac::DeleteDelegate() { | 106 void CollectedCookiesMac::DeleteDelegate() { |
| 107 delete this; | 107 delete this; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void CollectedCookiesMac::Observe(NotificationType type, | 110 void CollectedCookiesMac::Observe(int type, |
| 111 const NotificationSource& source, | 111 const NotificationSource& source, |
| 112 const NotificationDetails& details) { | 112 const NotificationDetails& details) { |
| 113 DCHECK(type == NotificationType::COLLECTED_COOKIES_SHOWN); | 113 DCHECK(type == chrome::COLLECTED_COOKIES_SHOWN); |
| 114 window_->CloseConstrainedWindow(); | 114 window_->CloseConstrainedWindow(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { | 117 void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { |
| 118 [sheet orderOut:sheet_controller_]; | 118 [sheet orderOut:sheet_controller_]; |
| 119 if (window_) | 119 if (window_) |
| 120 window_->CloseConstrainedWindow(); | 120 window_->CloseConstrainedWindow(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 #pragma mark Window Controller | 123 #pragma mark Window Controller |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 treeController = blockedTreeController_; | 507 treeController = blockedTreeController_; |
| 508 break; | 508 break; |
| 509 default: | 509 default: |
| 510 NOTREACHED(); | 510 NOTREACHED(); |
| 511 return; | 511 return; |
| 512 } | 512 } |
| 513 [detailsViewController_ configureBindingsForTreeController:treeController]; | 513 [detailsViewController_ configureBindingsForTreeController:treeController]; |
| 514 } | 514 } |
| 515 | 515 |
| 516 @end | 516 @end |
| OLD | NEW |