| 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/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/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 // it with text (it tells you it is single-line even if it is multiline), so | 459 // it with text (it tells you it is single-line even if it is multiline), so |
| 460 // here the hidden howToUse_ TextField is temporarily repurposed to | 460 // here the hidden howToUse_ TextField is temporarily repurposed to |
| 461 // calculate the correct height for the TextView. | 461 // calculate the correct height for the TextView. |
| 462 [[howToUse_ cell] setAttributedStringValue:[promo_ attributedString]]; | 462 [[howToUse_ cell] setAttributedStringValue:[promo_ attributedString]]; |
| 463 [GTMUILocalizerAndLayoutTweaker | 463 [GTMUILocalizerAndLayoutTweaker |
| 464 sizeToFitFixedWidthTextField:howToUse_]; | 464 sizeToFitFixedWidthTextField:howToUse_]; |
| 465 sync_promo_height = NSHeight([howToUse_ frame]); | 465 sync_promo_height = NSHeight([howToUse_ frame]); |
| 466 } | 466 } |
| 467 | 467 |
| 468 // First part of extension installed message, the heading. | 468 // First part of extension installed message, the heading. |
| 469 base::string16 extension_name = UTF8ToUTF16(extension_->name().c_str()); | 469 base::string16 extension_name = base::UTF8ToUTF16(extension_->name().c_str()); |
| 470 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 470 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
| 471 [heading_ setStringValue:l10n_util::GetNSStringF( | 471 [heading_ setStringValue:l10n_util::GetNSStringF( |
| 472 IDS_EXTENSION_INSTALLED_HEADING, extension_name)]; | 472 IDS_EXTENSION_INSTALLED_HEADING, extension_name)]; |
| 473 [GTMUILocalizerAndLayoutTweaker | 473 [GTMUILocalizerAndLayoutTweaker |
| 474 sizeToFitFixedWidthTextField:heading_]; | 474 sizeToFitFixedWidthTextField:heading_]; |
| 475 newWindowHeight += NSHeight([heading_ frame]) + | 475 newWindowHeight += NSHeight([heading_ frame]) + |
| 476 extension_installed_bubble::kInnerVerticalMargin; | 476 extension_installed_bubble::kInnerVerticalMargin; |
| 477 | 477 |
| 478 // If type is browser/page action, include a special message about them. | 478 // If type is browser/page action, include a special message about them. |
| 479 if (type_ == extension_installed_bubble::kBrowserAction || | 479 if (type_ == extension_installed_bubble::kBrowserAction || |
| 480 type_ == extension_installed_bubble::kPageAction) { | 480 type_ == extension_installed_bubble::kPageAction) { |
| 481 [howToUse_ setStringValue:[self | 481 [howToUse_ setStringValue:[self |
| 482 installMessageForCurrentExtensionAction]]; | 482 installMessageForCurrentExtensionAction]]; |
| 483 [howToUse_ setHidden:NO]; | 483 [howToUse_ setHidden:NO]; |
| 484 [[howToUse_ cell] | 484 [[howToUse_ cell] |
| 485 setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; | 485 setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; |
| 486 [GTMUILocalizerAndLayoutTweaker | 486 [GTMUILocalizerAndLayoutTweaker |
| 487 sizeToFitFixedWidthTextField:howToUse_]; | 487 sizeToFitFixedWidthTextField:howToUse_]; |
| 488 newWindowHeight += NSHeight([howToUse_ frame]) + | 488 newWindowHeight += NSHeight([howToUse_ frame]) + |
| 489 extension_installed_bubble::kInnerVerticalMargin; | 489 extension_installed_bubble::kInnerVerticalMargin; |
| 490 } | 490 } |
| 491 | 491 |
| 492 // If type is omnibox keyword, include a special message about the keyword. | 492 // If type is omnibox keyword, include a special message about the keyword. |
| 493 if (type_ == extension_installed_bubble::kOmniboxKeyword) { | 493 if (type_ == extension_installed_bubble::kOmniboxKeyword) { |
| 494 [howToUse_ setStringValue:l10n_util::GetNSStringF( | 494 [howToUse_ setStringValue:l10n_util::GetNSStringF( |
| 495 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, | 495 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, |
| 496 UTF8ToUTF16(extensions::OmniboxInfo::GetKeyword(extension_)))]; | 496 base::UTF8ToUTF16(extensions::OmniboxInfo::GetKeyword(extension_)))]; |
| 497 [howToUse_ setHidden:NO]; | 497 [howToUse_ setHidden:NO]; |
| 498 [[howToUse_ cell] | 498 [[howToUse_ cell] |
| 499 setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; | 499 setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; |
| 500 [GTMUILocalizerAndLayoutTweaker | 500 [GTMUILocalizerAndLayoutTweaker |
| 501 sizeToFitFixedWidthTextField:howToUse_]; | 501 sizeToFitFixedWidthTextField:howToUse_]; |
| 502 newWindowHeight += NSHeight([howToUse_ frame]) + | 502 newWindowHeight += NSHeight([howToUse_ frame]) + |
| 503 extension_installed_bubble::kInnerVerticalMargin; | 503 extension_installed_bubble::kInnerVerticalMargin; |
| 504 } | 504 } |
| 505 | 505 |
| 506 // If type is app, hide howToManage_, and include a "show me" link in the | 506 // If type is app, hide howToManage_, and include a "show me" link in the |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 ExtensionInstallUI::OpenAppInstalledUI(browser_->profile(), extension_->id()); | 696 ExtensionInstallUI::OpenAppInstalledUI(browser_->profile(), extension_->id()); |
| 697 } | 697 } |
| 698 | 698 |
| 699 - (void)awakeFromNib { | 699 - (void)awakeFromNib { |
| 700 if (bundle_) | 700 if (bundle_) |
| 701 return; | 701 return; |
| 702 [self initializeLabel]; | 702 [self initializeLabel]; |
| 703 } | 703 } |
| 704 | 704 |
| 705 @end | 705 @end |
| OLD | NEW |