| 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/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/extensions/api/commands/command_service.h" | 12 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 13 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | 13 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
| 14 #include "chrome/browser/extensions/bundle_installer.h" | 14 #include "chrome/browser/extensions/bundle_installer.h" |
| 15 #include "chrome/browser/extensions/extension_action.h" | 15 #include "chrome/browser/extensions/extension_action.h" |
| 16 #include "chrome/browser/extensions/extension_action_manager.h" | 16 #include "chrome/browser/extensions/extension_action_manager.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_navigator.h" | 18 #include "chrome/browser/ui/browser_navigator.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 20 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 21 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 21 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 22 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 22 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
| 23 #include "chrome/browser/ui/cocoa/hover_close_button.h" | 23 #include "chrome/browser/ui/cocoa/hover_close_button.h" |
| 24 #include "chrome/browser/ui/cocoa/info_bubble_view.h" | 24 #include "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 25 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 25 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 26 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 26 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 27 #include "chrome/browser/ui/singleton_tabs.h" | 27 #include "chrome/browser/ui/singleton_tabs.h" |
| 28 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
| 29 #include "chrome/common/extensions/api/commands/commands_handler.h" |
| 29 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" | 30 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" |
| 30 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
| 31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 32 #include "content/public/browser/notification_details.h" | 33 #include "content/public/browser/notification_details.h" |
| 33 #include "content/public/browser/notification_registrar.h" | 34 #include "content/public/browser/notification_registrar.h" |
| 34 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
| 35 #include "grit/chromium_strings.h" | 36 #include "grit/chromium_strings.h" |
| 36 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 37 #import "skia/ext/skia_utils_mac.h" | 38 #import "skia/ext/skia_utils_mac.h" |
| 38 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 39 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 292 } |
| 292 [iconImage_ setImage:icon_]; | 293 [iconImage_ setImage:icon_]; |
| 293 [iconImage_ setNeedsDisplay:YES]; | 294 [iconImage_ setNeedsDisplay:YES]; |
| 294 return window; | 295 return window; |
| 295 } | 296 } |
| 296 | 297 |
| 297 - (bool)hasActivePageAction:(extensions::Command*)command { | 298 - (bool)hasActivePageAction:(extensions::Command*)command { |
| 298 extensions::CommandService* command_service = | 299 extensions::CommandService* command_service = |
| 299 extensions::CommandServiceFactory::GetForProfile(browser_->profile()); | 300 extensions::CommandServiceFactory::GetForProfile(browser_->profile()); |
| 300 if (type_ == extension_installed_bubble::kPageAction) { | 301 if (type_ == extension_installed_bubble::kPageAction) { |
| 301 if (extension_->page_action_command() && | 302 if (CommandsInfo::GetPageActionCommand(extension_) && |
| 302 command_service->GetPageActionCommand( | 303 command_service->GetPageActionCommand( |
| 303 extension_->id(), | 304 extension_->id(), |
| 304 extensions::CommandService::ACTIVE_ONLY, | 305 extensions::CommandService::ACTIVE_ONLY, |
| 305 command, | 306 command, |
| 306 NULL)) { | 307 NULL)) { |
| 307 return true; | 308 return true; |
| 308 } | 309 } |
| 309 } | 310 } |
| 310 | 311 |
| 311 return false; | 312 return false; |
| 312 } | 313 } |
| 313 | 314 |
| 314 - (bool)hasActiveBrowserAction:(extensions::Command*)command { | 315 - (bool)hasActiveBrowserAction:(extensions::Command*)command { |
| 315 extensions::CommandService* command_service = | 316 extensions::CommandService* command_service = |
| 316 extensions::CommandServiceFactory::GetForProfile(browser_->profile()); | 317 extensions::CommandServiceFactory::GetForProfile(browser_->profile()); |
| 317 if (type_ == extension_installed_bubble::kBrowserAction) { | 318 if (type_ == extension_installed_bubble::kBrowserAction) { |
| 318 if (extension_->browser_action_command() && | 319 if (CommandsInfo::GetBrowserActionCommand(extension_) && |
| 319 command_service->GetBrowserActionCommand( | 320 command_service->GetBrowserActionCommand( |
| 320 extension_->id(), | 321 extension_->id(), |
| 321 extensions::CommandService::ACTIVE_ONLY, | 322 extensions::CommandService::ACTIVE_ONLY, |
| 322 command, | 323 command, |
| 323 NULL)) { | 324 NULL)) { |
| 324 return true; | 325 return true; |
| 325 } | 326 } |
| 326 } | 327 } |
| 327 | 328 |
| 328 return false; | 329 return false; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 - (IBAction)onManageShortcutClicked:(id)sender { | 565 - (IBAction)onManageShortcutClicked:(id)sender { |
| 565 [self close]; | 566 [self close]; |
| 566 std::string configure_url = chrome::kChromeUIExtensionsURL; | 567 std::string configure_url = chrome::kChromeUIExtensionsURL; |
| 567 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 568 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
| 568 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 569 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| 569 browser_, GURL(configure_url))); | 570 browser_, GURL(configure_url))); |
| 570 chrome::Navigate(¶ms); | 571 chrome::Navigate(¶ms); |
| 571 } | 572 } |
| 572 | 573 |
| 573 @end | 574 @end |
| OLD | NEW |