| 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/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/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 13 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 13 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 14 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 14 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 15 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 15 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
| 16 #include "chrome/browser/ui/cocoa/hover_close_button.h" | 16 #include "chrome/browser/ui/cocoa/hover_close_button.h" |
| 17 #include "chrome/browser/ui/cocoa/info_bubble_view.h" | 17 #include "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 18 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 18 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 19 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 19 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/extensions/extension_action.h" | 22 #include "chrome/common/extensions/extension_action.h" |
| 23 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
| 24 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
| 25 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
| 26 #include "grit/chromium_strings.h" |
| 26 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 27 #import "skia/ext/skia_utils_mac.h" | 28 #import "skia/ext/skia_utils_mac.h" |
| 28 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 29 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 | 31 |
| 31 using content::BrowserThread; | 32 using content::BrowserThread; |
| 32 | 33 |
| 33 // C++ class that receives EXTENSION_LOADED notifications and proxies them back | 34 // C++ class that receives EXTENSION_LOADED notifications and proxies them back |
| 34 // to |controller|. | 35 // to |controller|. |
| 35 class ExtensionLoadedNotificationObserver | 36 class ExtensionLoadedNotificationObserver |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // total of all message heights. | 298 // total of all message heights. |
| 298 - (int)calculateWindowHeight { | 299 - (int)calculateWindowHeight { |
| 299 // Adjust the window height to reflect the sum height of all messages | 300 // Adjust the window height to reflect the sum height of all messages |
| 300 // and vertical padding. | 301 // and vertical padding. |
| 301 int newWindowHeight = 2 * extension_installed_bubble::kOuterVerticalMargin; | 302 int newWindowHeight = 2 * extension_installed_bubble::kOuterVerticalMargin; |
| 302 | 303 |
| 303 // First part of extension installed message. | 304 // First part of extension installed message. |
| 304 string16 extension_name = UTF8ToUTF16(extension_->name().c_str()); | 305 string16 extension_name = UTF8ToUTF16(extension_->name().c_str()); |
| 305 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 306 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
| 306 [extensionInstalledMsg_ setStringValue:l10n_util::GetNSStringF( | 307 [extensionInstalledMsg_ setStringValue:l10n_util::GetNSStringF( |
| 307 IDS_EXTENSION_INSTALLED_HEADING, extension_name)]; | 308 IDS_EXTENSION_INSTALLED_HEADING, extension_name, |
| 309 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)]; |
| 308 [GTMUILocalizerAndLayoutTweaker | 310 [GTMUILocalizerAndLayoutTweaker |
| 309 sizeToFitFixedWidthTextField:extensionInstalledMsg_]; | 311 sizeToFitFixedWidthTextField:extensionInstalledMsg_]; |
| 310 newWindowHeight += [extensionInstalledMsg_ frame].size.height + | 312 newWindowHeight += [extensionInstalledMsg_ frame].size.height + |
| 311 extension_installed_bubble::kInnerVerticalMargin; | 313 extension_installed_bubble::kInnerVerticalMargin; |
| 312 | 314 |
| 313 // If type is page action, include a special message about page actions. | 315 // If type is page action, include a special message about page actions. |
| 314 if (type_ == extension_installed_bubble::kPageAction) { | 316 if (type_ == extension_installed_bubble::kPageAction) { |
| 315 [extraInfoMsg_ setHidden:NO]; | 317 [extraInfoMsg_ setHidden:NO]; |
| 316 [[extraInfoMsg_ cell] | 318 [[extraInfoMsg_ cell] |
| 317 setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; | 319 setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 387 |
| 386 - (NSRect)getExtensionInstalledInfoMsgFrame { | 388 - (NSRect)getExtensionInstalledInfoMsgFrame { |
| 387 return [extensionInstalledInfoMsg_ frame]; | 389 return [extensionInstalledInfoMsg_ frame]; |
| 388 } | 390 } |
| 389 | 391 |
| 390 - (void)extensionUnloaded:(id)sender { | 392 - (void)extensionUnloaded:(id)sender { |
| 391 extension_ = NULL; | 393 extension_ = NULL; |
| 392 } | 394 } |
| 393 | 395 |
| 394 @end | 396 @end |
| OLD | NEW |