| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/views/extensions/extension_installed_bubble_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/extensions/api/commands/command_service.h" | 13 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 14 #include "chrome/browser/extensions/extension_action.h" | 14 #include "chrome/browser/extensions/extension_action.h" |
| 15 #include "chrome/browser/extensions/extension_action_manager.h" | 15 #include "chrome/browser/extensions/extension_action_manager.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/signin/signin_promo.h" | 17 #include "chrome/browser/signin/signin_promo.h" |
| 18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/chrome_pages.h" |
| 20 #include "chrome/browser/ui/singleton_tabs.h" | 21 #include "chrome/browser/ui/singleton_tabs.h" |
| 21 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 22 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
| 22 #include "chrome/browser/ui/views/frame/browser_view.h" | 23 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 23 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 24 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 24 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 25 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 25 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 26 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 26 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 27 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 27 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" | 28 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
| 28 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 29 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 29 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" | 30 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 301 } |
| 301 | 302 |
| 302 void InstalledBubbleContent::ButtonPressed(views::Button* sender, | 303 void InstalledBubbleContent::ButtonPressed(views::Button* sender, |
| 303 const ui::Event& event) { | 304 const ui::Event& event) { |
| 304 DCHECK_EQ(sender, close_button_); | 305 DCHECK_EQ(sender, close_button_); |
| 305 GetWidget()->Close(); | 306 GetWidget()->Close(); |
| 306 } | 307 } |
| 307 | 308 |
| 308 void InstalledBubbleContent::LinkClicked(views::Link* source, int event_flags) { | 309 void InstalledBubbleContent::LinkClicked(views::Link* source, int event_flags) { |
| 309 GetWidget()->Close(); | 310 GetWidget()->Close(); |
| 310 std::string configure_url; | 311 |
| 311 if (source == manage_shortcut_) { | 312 if (source == sign_in_link_) { |
| 312 configure_url = chrome::kChromeUIExtensionsURL; | 313 chrome::ShowBrowserSignin( |
| 313 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 314 browser_, signin_metrics::SOURCE_EXTENSION_INSTALL_BUBBLE); |
| 314 } else if (source == sign_in_link_) { | |
| 315 configure_url = signin::GetPromoURL( | |
| 316 signin::SOURCE_EXTENSION_INSTALL_BUBBLE, false).spec(); | |
| 317 } else { | |
| 318 NOTREACHED(); | |
| 319 return; | 315 return; |
| 320 } | 316 } |
| 321 chrome::NavigateParams params( | 317 |
| 322 chrome::GetSingletonTabNavigateParams( | 318 DCHECK_EQ(manage_shortcut_, source); |
| 323 browser_, GURL(configure_url.c_str()))); | 319 |
| 320 std::string configure_url = chrome::kChromeUIExtensionsURL; |
| 321 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
| 322 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| 323 browser_, GURL(configure_url))); |
| 324 chrome::Navigate(¶ms); | 324 chrome::Navigate(¶ms); |
| 325 } | 325 } |
| 326 | 326 |
| 327 bool InstalledBubbleContent::GetKeybinding(extensions::Command* command) { | 327 bool InstalledBubbleContent::GetKeybinding(extensions::Command* command) { |
| 328 extensions::CommandService* command_service = | 328 extensions::CommandService* command_service = |
| 329 extensions::CommandService::Get(browser_->profile()); | 329 extensions::CommandService::Get(browser_->profile()); |
| 330 if (type_ == ExtensionInstalledBubble::BROWSER_ACTION) { | 330 if (type_ == ExtensionInstalledBubble::BROWSER_ACTION) { |
| 331 return command_service->GetBrowserActionCommand( | 331 return command_service->GetBrowserActionCommand( |
| 332 extension_id_, | 332 extension_id_, |
| 333 extensions::CommandService::ACTIVE_ONLY, | 333 extensions::CommandService::ACTIVE_ONLY, |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && | 617 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && |
| 618 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { | 618 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { |
| 619 BrowserView* browser_view = | 619 BrowserView* browser_view = |
| 620 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); | 620 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); |
| 621 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 621 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
| 622 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> | 622 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> |
| 623 GetPageAction(*bubble_.extension()), | 623 GetPageAction(*bubble_.extension()), |
| 624 false); // preview_enabled | 624 false); // preview_enabled |
| 625 } | 625 } |
| 626 } | 626 } |
| OLD | NEW |