| 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/page_info_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/page_info_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| 11 #include "chrome/browser/certificate_viewer.h" | 11 #include "chrome/browser/certificate_viewer.h" |
| 12 #include "chrome/browser/google/google_util.h" | 12 #include "chrome/browser/google/google_util.h" |
| 13 #include "chrome/browser/page_info_model.h" | 13 #include "chrome/browser/page_info_model.h" |
| 14 #include "chrome/browser/page_info_model_observer.h" | 14 #include "chrome/browser/page_info_model_observer.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
| 17 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 18 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 18 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 19 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
| 19 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 20 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 20 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 21 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 21 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 22 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 23 #include "content/browser/cert_store.h" | 24 #include "content/browser/cert_store.h" |
| 24 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 25 #include "grit/locale_settings.h" | 26 #include "grit/locale_settings.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // Factory that vends RunnableMethod tasks for scheduling layout. | 144 // Factory that vends RunnableMethod tasks for scheduling layout. |
| 144 ScopedRunnableMethodFactory<PageInfoModelBubbleBridge> task_factory_; | 145 ScopedRunnableMethodFactory<PageInfoModelBubbleBridge> task_factory_; |
| 145 | 146 |
| 146 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); | 147 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 } // namespace | 150 } // namespace |
| 150 | 151 |
| 151 namespace browser { | 152 namespace browser { |
| 152 | 153 |
| 153 void ShowPageInfoBubble(gfx::NativeWindow parent, | 154 void ShowPageInfoBubble(Browser* browser, |
| 154 Profile* profile, | 155 Profile* profile, |
| 155 const GURL& url, | 156 const GURL& url, |
| 156 const NavigationEntry::SSLStatus& ssl, | 157 const NavigationEntry::SSLStatus& ssl, |
| 157 bool show_history) { | 158 bool show_history) { |
| 158 PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); | 159 PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); |
| 159 PageInfoModel* model = | 160 PageInfoModel* model = |
| 160 new PageInfoModel(profile, url, ssl, show_history, bridge); | 161 new PageInfoModel(profile, url, ssl, show_history, bridge); |
| 162 gfx::NativeWindow parent = browser->window()->GetNativeHandle(); |
| 161 PageInfoBubbleController* controller = | 163 PageInfoBubbleController* controller = |
| 162 [[PageInfoBubbleController alloc] initWithPageInfoModel:model | 164 [[PageInfoBubbleController alloc] initWithPageInfoModel:model |
| 163 modelObserver:bridge | 165 modelObserver:bridge |
| 164 parentWindow:parent]; | 166 parentWindow:parent]; |
| 165 bridge->set_controller(controller); | 167 bridge->set_controller(controller); |
| 166 [controller setCertID:ssl.cert_id()]; | 168 [controller setCertID:ssl.cert_id()]; |
| 167 [controller showWindow:nil]; | 169 [controller showWindow:nil]; |
| 168 } | 170 } |
| 169 | 171 |
| 170 } // namespace browser | 172 } // namespace browser |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 LocationBarViewMac* locationBar = [controller locationBarBridge]; | 477 LocationBarViewMac* locationBar = [controller locationBarBridge]; |
| 476 if (locationBar) { | 478 if (locationBar) { |
| 477 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); | 479 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); |
| 478 origin = [parent convertBaseToScreen:bubblePoint]; | 480 origin = [parent convertBaseToScreen:bubblePoint]; |
| 479 } | 481 } |
| 480 } | 482 } |
| 481 return origin; | 483 return origin; |
| 482 } | 484 } |
| 483 | 485 |
| 484 @end | 486 @end |
| OLD | NEW |