Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm

Issue 1508893003: Use proper namespace in skia/ext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/extensions/extension_installed_bubble_controlle r.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 - (id)initWithParentWindow:(NSWindow*)parentWindow 119 - (id)initWithParentWindow:(NSWindow*)parentWindow
120 extensionBubble:(ExtensionInstalledBubble*)extensionBubble { 120 extensionBubble:(ExtensionInstalledBubble*)extensionBubble {
121 if ((self = [super initWithWindowNibPath:@"ExtensionInstalledBubble" 121 if ((self = [super initWithWindowNibPath:@"ExtensionInstalledBubble"
122 parentWindow:parentWindow 122 parentWindow:parentWindow
123 anchoredAt:NSZeroPoint])) { 123 anchoredAt:NSZeroPoint])) {
124 DCHECK(extensionBubble); 124 DCHECK(extensionBubble);
125 const extensions::Extension* extension = extensionBubble->extension(); 125 const extensions::Extension* extension = extensionBubble->extension();
126 browser_ = extensionBubble->browser(); 126 browser_ = extensionBubble->browser();
127 DCHECK(browser_); 127 DCHECK(browser_);
128 icon_.reset([gfx::SkBitmapToNSImage(extensionBubble->icon()) retain]); 128 icon_.reset([skia::SkBitmapToNSImage(extensionBubble->icon()) retain]);
129 pageActionPreviewShowing_ = NO; 129 pageActionPreviewShowing_ = NO;
130 130
131 if (extension->is_app()) { 131 if (extension->is_app()) {
132 type_ = extension_installed_bubble::kApp; 132 type_ = extension_installed_bubble::kApp;
133 } else if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) { 133 } else if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) {
134 type_ = extension_installed_bubble::kOmniboxKeyword; 134 type_ = extension_installed_bubble::kOmniboxKeyword;
135 } else if (extensions::ActionInfo::GetBrowserActionInfo(extension)) { 135 } else if (extensions::ActionInfo::GetBrowserActionInfo(extension)) {
136 type_ = extension_installed_bubble::kBrowserAction; 136 type_ = extension_installed_bubble::kBrowserAction;
137 } else if (extensions::ActionInfo::GetPageActionInfo(extension) && 137 } else if (extensions::ActionInfo::GetPageActionInfo(extension) &&
138 extensions::ActionInfo::IsVerboseInstallMessage(extension)) { 138 extensions::ActionInfo::IsVerboseInstallMessage(extension)) {
139 type_ = extension_installed_bubble::kPageAction; 139 type_ = extension_installed_bubble::kPageAction;
140 } else { 140 } else {
141 type_ = extension_installed_bubble::kGeneric; 141 type_ = extension_installed_bubble::kGeneric;
142 } 142 }
143 143
144 installedBubble_ = extensionBubble; 144 installedBubble_ = extensionBubble;
145 } 145 }
146 return self; 146 return self;
147 } 147 }
148 148
149 - (id)initWithParentWindow:(NSWindow*)parentWindow 149 - (id)initWithParentWindow:(NSWindow*)parentWindow
150 bundle:(const BundleInstaller*)bundle 150 bundle:(const BundleInstaller*)bundle
151 browser:(Browser*)browser { 151 browser:(Browser*)browser {
152 if ((self = [super initWithWindowNibPath:@"ExtensionInstalledBubbleBundle" 152 if ((self = [super initWithWindowNibPath:@"ExtensionInstalledBubbleBundle"
153 parentWindow:parentWindow 153 parentWindow:parentWindow
154 anchoredAt:NSZeroPoint])) { 154 anchoredAt:NSZeroPoint])) {
155 bundle_ = bundle; 155 bundle_ = bundle;
156 DCHECK(browser); 156 DCHECK(browser);
157 browser_ = browser; 157 browser_ = browser;
158 icon_.reset([gfx::SkBitmapToNSImage(SkBitmap()) retain]); 158 icon_.reset([skia::SkBitmapToNSImage(SkBitmap()) retain]);
159 pageActionPreviewShowing_ = NO; 159 pageActionPreviewShowing_ = NO;
160 type_ = extension_installed_bubble::kBundle; 160 type_ = extension_installed_bubble::kBundle;
161 [self showWindow:self]; 161 [self showWindow:self];
162 } 162 }
163 return self; 163 return self;
164 } 164 }
165 165
166 - (const Extension*)extension { 166 - (const Extension*)extension {
167 if (type_ == extension_installed_bubble::kBundle || !installedBubble_) 167 if (type_ == extension_installed_bubble::kBundle || !installedBubble_)
168 return nullptr; 168 return nullptr;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 NSString* link(l10n_util::GetNSStringWithFixup( 400 NSString* link(l10n_util::GetNSStringWithFixup(
401 IDS_EXTENSION_INSTALLED_SIGNIN_PROMO_LINK)); 401 IDS_EXTENSION_INSTALLED_SIGNIN_PROMO_LINK));
402 NSString* message(l10n_util::GetNSStringWithFixup( 402 NSString* message(l10n_util::GetNSStringWithFixup(
403 IDS_EXTENSION_INSTALLED_SIGNIN_PROMO)); 403 IDS_EXTENSION_INSTALLED_SIGNIN_PROMO));
404 message = [link stringByAppendingString:message]; 404 message = [link stringByAppendingString:message];
405 405
406 HyperlinkTextView* view = promo_.get(); 406 HyperlinkTextView* view = promo_.get();
407 [view setMessage:message withFont:font messageColor:[NSColor blackColor]]; 407 [view setMessage:message withFont:font messageColor:[NSColor blackColor]];
408 [view addLinkRange:NSMakeRange(0, [link length]) 408 [view addLinkRange:NSMakeRange(0, [link length])
409 withURL:@"about:blank" // using a link here is bad ui 409 withURL:@"about:blank" // using a link here is bad ui
410 linkColor:gfx::SkColorToCalibratedNSColor( 410 linkColor:skia::SkColorToCalibratedNSColor(
411 chrome_style::GetLinkColor())]; 411 chrome_style::GetLinkColor())];
412 412
413 // HACK! The TextView does not report correct height even after you stuff 413 // HACK! The TextView does not report correct height even after you stuff
414 // it with text (it tells you it is single-line even if it is multiline), so 414 // it with text (it tells you it is single-line even if it is multiline), so
415 // here the hidden howToUse_ TextField is temporarily repurposed to 415 // here the hidden howToUse_ TextField is temporarily repurposed to
416 // calculate the correct height for the TextView. 416 // calculate the correct height for the TextView.
417 [[howToUse_ cell] setAttributedStringValue:[promo_ attributedString]]; 417 [[howToUse_ cell] setAttributedStringValue:[promo_ attributedString]];
418 [GTMUILocalizerAndLayoutTweaker 418 [GTMUILocalizerAndLayoutTweaker
419 sizeToFitFixedWidthTextField:howToUse_]; 419 sizeToFitFixedWidthTextField:howToUse_];
420 sync_promo_height = NSHeight([howToUse_ frame]); 420 sync_promo_height = NSHeight([howToUse_ frame]);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 newWindowHeight += extension_installed_bubble::kInnerVerticalMargin; 482 newWindowHeight += extension_installed_bubble::kInnerVerticalMargin;
483 newWindowHeight += sync_promo_height; 483 newWindowHeight += sync_promo_height;
484 } 484 }
485 485
486 if (type_ != extension_installed_bubble::kBundle && 486 if (type_ != extension_installed_bubble::kBundle &&
487 installedBubble_->has_command_keybinding()) { 487 installedBubble_->has_command_keybinding()) {
488 [manageShortcutLink_ setHidden:NO]; 488 [manageShortcutLink_ setHidden:NO];
489 [[manageShortcutLink_ cell] 489 [[manageShortcutLink_ cell]
490 setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; 490 setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
491 [[manageShortcutLink_ cell] 491 [[manageShortcutLink_ cell]
492 setTextColor:gfx::SkColorToCalibratedNSColor( 492 setTextColor:skia::SkColorToCalibratedNSColor(
493 chrome_style::GetLinkColor())]; 493 chrome_style::GetLinkColor())];
494 [GTMUILocalizerAndLayoutTweaker sizeToFitView:manageShortcutLink_]; 494 [GTMUILocalizerAndLayoutTweaker sizeToFitView:manageShortcutLink_];
495 newWindowHeight += extension_installed_bubble::kInnerVerticalMargin; 495 newWindowHeight += extension_installed_bubble::kInnerVerticalMargin;
496 newWindowHeight += NSHeight([manageShortcutLink_ frame]); 496 newWindowHeight += NSHeight([manageShortcutLink_ frame]);
497 } 497 }
498 498
499 return newWindowHeight; 499 return newWindowHeight;
500 } 500 }
501 501
502 - (NSInteger)addExtensionList:(NSTextField*)headingMsg 502 - (NSInteger)addExtensionList:(NSTextField*)headingMsg
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 [self close]; 654 [self close];
655 } 655 }
656 656
657 - (void)awakeFromNib { 657 - (void)awakeFromNib {
658 if (bundle_) 658 if (bundle_)
659 return; 659 return;
660 [self initializeLabel]; 660 [self initializeLabel];
661 } 661 }
662 662
663 @end 663 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698