| 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 "chrome/browser/ui/cocoa/page_info_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/page_info_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 PageInfoBubbleController* controller_; // weak | 149 PageInfoBubbleController* controller_; // weak |
| 150 | 150 |
| 151 base::WeakPtrFactory<PageInfoModelBubbleBridge> weak_ptr_factory_; | 151 base::WeakPtrFactory<PageInfoModelBubbleBridge> weak_ptr_factory_; |
| 152 | 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); | 153 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 } // namespace | 156 } // namespace |
| 157 | 157 |
| 158 namespace browser { | 158 namespace chrome { |
| 159 | 159 |
| 160 void ShowPageInfoBubble(gfx::NativeWindow parent, | 160 void ShowPageInfoBubble(gfx::NativeWindow parent, |
| 161 WebContents* web_contents, | 161 WebContents* web_contents, |
| 162 const GURL& url, | 162 const GURL& url, |
| 163 const SSLStatus& ssl, | 163 const SSLStatus& ssl, |
| 164 bool show_history, | 164 bool show_history, |
| 165 content::PageNavigator* navigator) { | 165 content::PageNavigator* navigator) { |
| 166 PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); | 166 PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); |
| 167 PageInfoModel* model = new PageInfoModel( | 167 PageInfoModel* model = new PageInfoModel( |
| 168 Profile::FromBrowserContext(web_contents->GetBrowserContext()), url, ssl, | 168 Profile::FromBrowserContext(web_contents->GetBrowserContext()), url, ssl, |
| 169 show_history, bridge); | 169 show_history, bridge); |
| 170 PageInfoBubbleController* controller = | 170 PageInfoBubbleController* controller = |
| 171 [[PageInfoBubbleController alloc] initWithPageInfoModel:model | 171 [[PageInfoBubbleController alloc] initWithPageInfoModel:model |
| 172 modelObserver:bridge | 172 modelObserver:bridge |
| 173 parentWindow:parent | 173 parentWindow:parent |
| 174 webContents:web_contents | 174 webContents:web_contents |
| 175 navigator:navigator]; | 175 navigator:navigator]; |
| 176 bridge->set_controller(controller); | 176 bridge->set_controller(controller); |
| 177 [controller setCertID:ssl.cert_id]; | 177 [controller setCertID:ssl.cert_id]; |
| 178 [controller showWindow:nil]; | 178 [controller showWindow:nil]; |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace browser | 181 } // namespace chrome |
| 182 | 182 |
| 183 @implementation PageInfoBubbleController | 183 @implementation PageInfoBubbleController |
| 184 | 184 |
| 185 @synthesize certID = certID_; | 185 @synthesize certID = certID_; |
| 186 | 186 |
| 187 - (id)initWithPageInfoModel:(PageInfoModel*)model | 187 - (id)initWithPageInfoModel:(PageInfoModel*)model |
| 188 modelObserver:(PageInfoModelObserver*)bridge | 188 modelObserver:(PageInfoModelObserver*)bridge |
| 189 parentWindow:(NSWindow*)parentWindow | 189 parentWindow:(NSWindow*)parentWindow |
| 190 webContents:(WebContents*)webContents | 190 webContents:(WebContents*)webContents |
| 191 navigator:(content::PageNavigator*)navigator { | 191 navigator:(content::PageNavigator*)navigator { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 LocationBarViewMac* locationBar = [controller locationBarBridge]; | 486 LocationBarViewMac* locationBar = [controller locationBarBridge]; |
| 487 if (locationBar) { | 487 if (locationBar) { |
| 488 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); | 488 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); |
| 489 origin = [parent convertBaseToScreen:bubblePoint]; | 489 origin = [parent convertBaseToScreen:bubblePoint]; |
| 490 } | 490 } |
| 491 } | 491 } |
| 492 return origin; | 492 return origin; |
| 493 } | 493 } |
| 494 | 494 |
| 495 @end | 495 @end |
| OLD | NEW |