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" | |
14 #include "chrome/browser/extensions/bundle_installer.h" | 13 #include "chrome/browser/extensions/bundle_installer.h" |
15 #include "chrome/browser/extensions/extension_action.h" | 14 #include "chrome/browser/extensions/extension_action.h" |
16 #include "chrome/browser/extensions/extension_action_manager.h" | 15 #include "chrome/browser/extensions/extension_action_manager.h" |
17 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_navigator.h" | 17 #include "chrome/browser/ui/browser_navigator.h" |
19 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 19 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
21 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 20 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
22 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 21 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
23 #include "chrome/browser/ui/cocoa/hover_close_button.h" | 22 #include "chrome/browser/ui/cocoa/hover_close_button.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 [icon_ setSize:NSMakeSize(extension_installed_bubble::kIconSize, | 288 [icon_ setSize:NSMakeSize(extension_installed_bubble::kIconSize, |
290 extension_installed_bubble::kIconSize)]; | 289 extension_installed_bubble::kIconSize)]; |
291 } | 290 } |
292 [iconImage_ setImage:icon_]; | 291 [iconImage_ setImage:icon_]; |
293 [iconImage_ setNeedsDisplay:YES]; | 292 [iconImage_ setNeedsDisplay:YES]; |
294 return window; | 293 return window; |
295 } | 294 } |
296 | 295 |
297 - (bool)hasActivePageAction:(extensions::Command*)command { | 296 - (bool)hasActivePageAction:(extensions::Command*)command { |
298 extensions::CommandService* command_service = | 297 extensions::CommandService* command_service = |
299 extensions::CommandServiceFactory::GetForProfile(browser_->profile()); | 298 extensions::CommandService::Get(browser_->profile()); |
300 if (type_ == extension_installed_bubble::kPageAction) { | 299 if (type_ == extension_installed_bubble::kPageAction) { |
301 if (extension_->page_action_command() && | 300 if (extension_->page_action_command() && |
302 command_service->GetPageActionCommand( | 301 command_service->GetPageActionCommand( |
303 extension_->id(), | 302 extension_->id(), |
304 extensions::CommandService::ACTIVE_ONLY, | 303 extensions::CommandService::ACTIVE_ONLY, |
305 command, | 304 command, |
306 NULL)) { | 305 NULL)) { |
307 return true; | 306 return true; |
308 } | 307 } |
309 } | 308 } |
310 | 309 |
311 return false; | 310 return false; |
312 } | 311 } |
313 | 312 |
314 - (bool)hasActiveBrowserAction:(extensions::Command*)command { | 313 - (bool)hasActiveBrowserAction:(extensions::Command*)command { |
315 extensions::CommandService* command_service = | 314 extensions::CommandService* command_service = |
316 extensions::CommandServiceFactory::GetForProfile(browser_->profile()); | 315 extensions::CommandService::Get(browser_->profile()); |
317 if (type_ == extension_installed_bubble::kBrowserAction) { | 316 if (type_ == extension_installed_bubble::kBrowserAction) { |
318 if (extension_->browser_action_command() && | 317 if (extension_->browser_action_command() && |
319 command_service->GetBrowserActionCommand( | 318 command_service->GetBrowserActionCommand( |
320 extension_->id(), | 319 extension_->id(), |
321 extensions::CommandService::ACTIVE_ONLY, | 320 extensions::CommandService::ACTIVE_ONLY, |
322 command, | 321 command, |
323 NULL)) { | 322 NULL)) { |
324 return true; | 323 return true; |
325 } | 324 } |
326 } | 325 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 - (IBAction)onManageShortcutClicked:(id)sender { | 563 - (IBAction)onManageShortcutClicked:(id)sender { |
565 [self close]; | 564 [self close]; |
566 std::string configure_url = chrome::kChromeUIExtensionsURL; | 565 std::string configure_url = chrome::kChromeUIExtensionsURL; |
567 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 566 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
568 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 567 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
569 browser_, GURL(configure_url))); | 568 browser_, GURL(configure_url))); |
570 chrome::Navigate(¶ms); | 569 chrome::Navigate(¶ms); |
571 } | 570 } |
572 | 571 |
573 @end | 572 @end |
OLD | NEW |