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/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
11 #include "chrome/browser/cert_store.h" | 11 #include "chrome/browser/cert_store.h" |
12 #include "chrome/browser/certificate_viewer.h" | 12 #include "chrome/browser/certificate_viewer.h" |
13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 15 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
16 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 16 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
17 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 17 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
18 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 18 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
19 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 19 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "grit/locale_settings.h" | 22 #include "grit/locale_settings.h" |
23 #include "net/base/cert_status_flags.h" | 23 #include "net/base/cert_status_flags.h" |
24 #include "net/base/x509_certificate.h" | 24 #include "net/base/x509_certificate.h" |
25 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 25 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/l10n/l10n_util_mac.h" | 27 #include "ui/base/l10n/l10n_util_mac.h" |
| 28 #include "ui/gfx/image.h" |
28 | 29 |
29 @interface PageInfoBubbleController (Private) | 30 @interface PageInfoBubbleController (Private) |
30 - (PageInfoModel*)model; | 31 - (PageInfoModel*)model; |
31 - (NSButton*)certificateButtonWithFrame:(NSRect)frame; | 32 - (NSButton*)certificateButtonWithFrame:(NSRect)frame; |
32 - (void)configureTextFieldAsLabel:(NSTextField*)textField; | 33 - (void)configureTextFieldAsLabel:(NSTextField*)textField; |
33 - (CGFloat)addHeadlineViewForInfo:(const PageInfoModel::SectionInfo&)info | 34 - (CGFloat)addHeadlineViewForInfo:(const PageInfoModel::SectionInfo&)info |
34 toSubviews:(NSMutableArray*)subviews | 35 toSubviews:(NSMutableArray*)subviews |
35 atPoint:(NSPoint)point; | 36 atPoint:(NSPoint)point; |
36 - (CGFloat)addDescriptionViewForInfo:(const PageInfoModel::SectionInfo&)info | 37 - (CGFloat)addDescriptionViewForInfo:(const PageInfoModel::SectionInfo&)info |
37 toSubviews:(NSMutableArray*)subviews | 38 toSubviews:(NSMutableArray*)subviews |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // does not affect the next Y position because the image is placed next to | 396 // does not affect the next Y position because the image is placed next to |
396 // a text field that is larger and accounts for the image's size. | 397 // a text field that is larger and accounts for the image's size. |
397 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info | 398 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info |
398 toSubviews:(NSMutableArray*)subviews | 399 toSubviews:(NSMutableArray*)subviews |
399 atOffset:(CGFloat)offset { | 400 atOffset:(CGFloat)offset { |
400 NSRect frame = | 401 NSRect frame = |
401 NSMakeRect(kFramePadding, offset, kImageSize, kImageSize); | 402 NSMakeRect(kFramePadding, offset, kImageSize, kImageSize); |
402 scoped_nsobject<NSImageView> imageView( | 403 scoped_nsobject<NSImageView> imageView( |
403 [[NSImageView alloc] initWithFrame:frame]); | 404 [[NSImageView alloc] initWithFrame:frame]); |
404 [imageView setImageFrameStyle:NSImageFrameNone]; | 405 [imageView setImageFrameStyle:NSImageFrameNone]; |
405 [imageView setImage:model_->GetIconImage(info.icon_id)]; | 406 [imageView setImage:*model_->GetIconImage(info.icon_id)]; |
406 [subviews addObject:imageView.get()]; | 407 [subviews addObject:imageView.get()]; |
407 } | 408 } |
408 | 409 |
409 // Adds the help center button that explains the icons. Returns the y position | 410 // Adds the help center button that explains the icons. Returns the y position |
410 // delta for the next offset. | 411 // delta for the next offset. |
411 - (CGFloat)addHelpButtonToSubviews:(NSMutableArray*)subviews | 412 - (CGFloat)addHelpButtonToSubviews:(NSMutableArray*)subviews |
412 atOffset:(CGFloat)offset { | 413 atOffset:(CGFloat)offset { |
413 NSRect frame = NSMakeRect(kFramePadding, offset, 100, 10); | 414 NSRect frame = NSMakeRect(kFramePadding, offset, 100, 10); |
414 scoped_nsobject<NSButton> button([[NSButton alloc] initWithFrame:frame]); | 415 scoped_nsobject<NSButton> button([[NSButton alloc] initWithFrame:frame]); |
415 NSString* string = | 416 NSString* string = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 LocationBarViewMac* locationBar = [controller locationBarBridge]; | 456 LocationBarViewMac* locationBar = [controller locationBarBridge]; |
456 if (locationBar) { | 457 if (locationBar) { |
457 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); | 458 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); |
458 origin = [parent convertBaseToScreen:bubblePoint]; | 459 origin = [parent convertBaseToScreen:bubblePoint]; |
459 } | 460 } |
460 } | 461 } |
461 return origin; | 462 return origin; |
462 } | 463 } |
463 | 464 |
464 @end | 465 @end |
OLD | NEW |