| 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" |
| 11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 12 #include "chrome/browser/certificate_viewer.h" | 12 #include "chrome/browser/certificate_viewer.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_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
| 17 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 17 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 18 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 18 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
| 19 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 19 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 20 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 20 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 21 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 21 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 22 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 23 #include "content/public/browser/cert_store.h" | 24 #include "content/public/browser/cert_store.h" |
| 24 #include "content/public/browser/page_navigator.h" | 25 #include "content/public/browser/page_navigator.h" |
| 25 #include "content/public/common/ssl_status.h" | 26 #include "content/public/common/ssl_status.h" |
| 26 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 27 #include "grit/locale_settings.h" | 28 #include "grit/locale_settings.h" |
| 28 #include "net/base/cert_status_flags.h" | 29 #include "net/base/cert_status_flags.h" |
| 29 #include "net/base/x509_certificate.h" | 30 #include "net/base/x509_certificate.h" |
| 30 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 31 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 base::WeakPtrFactory<PageInfoModelBubbleBridge> weak_ptr_factory_; | 150 base::WeakPtrFactory<PageInfoModelBubbleBridge> weak_ptr_factory_; |
| 150 | 151 |
| 151 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); | 152 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); |
| 152 }; | 153 }; |
| 153 | 154 |
| 154 } // namespace | 155 } // namespace |
| 155 | 156 |
| 156 namespace browser { | 157 namespace browser { |
| 157 | 158 |
| 158 void ShowPageInfoBubble(gfx::NativeWindow parent, | 159 void ShowPageInfoBubble(gfx::NativeWindow parent, |
| 159 Profile* profile, | 160 TabContents* tab_contents, |
| 160 const GURL& url, | 161 const GURL& url, |
| 161 const SSLStatus& ssl, | 162 const SSLStatus& ssl, |
| 162 bool show_history, | 163 bool show_history, |
| 163 content::PageNavigator* navigator) { | 164 content::PageNavigator* navigator) { |
| 164 PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); | 165 PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); |
| 165 PageInfoModel* model = | 166 PageInfoModel* model = new PageInfoModel( |
| 166 new PageInfoModel(profile, url, ssl, show_history, bridge); | 167 tab_contents->profile(), url, ssl, show_history, bridge); |
| 167 PageInfoBubbleController* controller = | 168 PageInfoBubbleController* controller = |
| 168 [[PageInfoBubbleController alloc] initWithPageInfoModel:model | 169 [[PageInfoBubbleController alloc] initWithPageInfoModel:model |
| 169 modelObserver:bridge | 170 modelObserver:bridge |
| 170 parentWindow:parent | 171 parentWindow:parent |
| 171 navigator:navigator]; | 172 navigator:navigator]; |
| 172 bridge->set_controller(controller); | 173 bridge->set_controller(controller); |
| 173 [controller setCertID:ssl.cert_id]; | 174 [controller setCertID:ssl.cert_id]; |
| 174 [controller showWindow:nil]; | 175 [controller showWindow:nil]; |
| 175 } | 176 } |
| 176 | 177 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 LocationBarViewMac* locationBar = [controller locationBarBridge]; | 481 LocationBarViewMac* locationBar = [controller locationBarBridge]; |
| 481 if (locationBar) { | 482 if (locationBar) { |
| 482 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); | 483 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); |
| 483 origin = [parent convertBaseToScreen:bubblePoint]; | 484 origin = [parent convertBaseToScreen:bubblePoint]; |
| 484 } | 485 } |
| 485 } | 486 } |
| 486 return origin; | 487 return origin; |
| 487 } | 488 } |
| 488 | 489 |
| 489 @end | 490 @end |
| OLD | NEW |