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/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
23 #include "content/browser/cert_store.h" | 23 #include "content/public/browser/cert_store.h" |
24 #include "content/public/common/ssl_status.h" | 24 #include "content/public/common/ssl_status.h" |
25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
26 #include "grit/locale_settings.h" | 26 #include "grit/locale_settings.h" |
27 #include "net/base/cert_status_flags.h" | 27 #include "net/base/cert_status_flags.h" |
28 #include "net/base/x509_certificate.h" | 28 #include "net/base/x509_certificate.h" |
29 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 29 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/base/l10n/l10n_util_mac.h" | 31 #include "ui/base/l10n/l10n_util_mac.h" |
32 #include "ui/gfx/image/image.h" | 32 #include "ui/gfx/image/image.h" |
33 | 33 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 // Create the certificate button. The frame will be fixed up by GTM, so | 399 // Create the certificate button. The frame will be fixed up by GTM, so |
400 // use arbitrary values. | 400 // use arbitrary values. |
401 NSRect frame = NSMakeRect(kTextXPosition, offset, 100, 14); | 401 NSRect frame = NSMakeRect(kTextXPosition, offset, 100, 14); |
402 NSButton* certButton = [self certificateButtonWithFrame:frame]; | 402 NSButton* certButton = [self certificateButtonWithFrame:frame]; |
403 [subviews addObject:certButton]; | 403 [subviews addObject:certButton]; |
404 [GTMUILocalizerAndLayoutTweaker sizeToFitView:certButton]; | 404 [GTMUILocalizerAndLayoutTweaker sizeToFitView:certButton]; |
405 | 405 |
406 // By default, assume that we don't have certificate information to show. | 406 // By default, assume that we don't have certificate information to show. |
407 scoped_refptr<net::X509Certificate> cert; | 407 scoped_refptr<net::X509Certificate> cert; |
408 CertStore::GetInstance()->RetrieveCert(certID_, &cert); | 408 content::CertStore::GetInstance()->RetrieveCert(certID_, &cert); |
409 | 409 |
410 // Don't bother showing certificates if there isn't one. | 410 // Don't bother showing certificates if there isn't one. |
411 if (!cert.get() || !cert->os_cert_handle()) { | 411 if (!cert.get() || !cert->os_cert_handle()) { |
412 // This should only ever happen in unit tests. | 412 // This should only ever happen in unit tests. |
413 [certButton setEnabled:NO]; | 413 [certButton setEnabled:NO]; |
414 } | 414 } |
415 | 415 |
416 return NSHeight([certButton frame]); | 416 return NSHeight([certButton frame]); |
417 } | 417 } |
418 | 418 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 LocationBarViewMac* locationBar = [controller locationBarBridge]; | 475 LocationBarViewMac* locationBar = [controller locationBarBridge]; |
476 if (locationBar) { | 476 if (locationBar) { |
477 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); | 477 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); |
478 origin = [parent convertBaseToScreen:bubblePoint]; | 478 origin = [parent convertBaseToScreen:bubblePoint]; |
479 } | 479 } |
480 } | 480 } |
481 return origin; | 481 return origin; |
482 } | 482 } |
483 | 483 |
484 @end | 484 @end |
OLD | NEW |