| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 231 } |
| 231 | 232 |
| 232 void ButtonPressed(views::Button* sender, const ui::Event& event) override { | 233 void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
| 233 DCHECK_EQ(sender, close_button_); | 234 DCHECK_EQ(sender, close_button_); |
| 234 GetWidget()->Close(); | 235 GetWidget()->Close(); |
| 235 } | 236 } |
| 236 | 237 |
| 237 // Implements the views::LinkListener interface. | 238 // Implements the views::LinkListener interface. |
| 238 void LinkClicked(views::Link* source, int event_flags) override { | 239 void LinkClicked(views::Link* source, int event_flags) override { |
| 239 GetWidget()->Close(); | 240 GetWidget()->Close(); |
| 240 std::string configure_url; | 241 |
| 241 if (source == manage_shortcut_) { | 242 if (source == sign_in_link_) { |
| 242 configure_url = chrome::kChromeUIExtensionsURL; | 243 chrome::ShowBrowserSignin( |
| 243 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 244 browser_, signin_metrics::SOURCE_EXTENSION_INSTALL_BUBBLE); |
| 244 } else if (source == sign_in_link_) { | |
| 245 configure_url = signin::GetPromoURL( | |
| 246 signin::SOURCE_EXTENSION_INSTALL_BUBBLE, false).spec(); | |
| 247 } else { | |
| 248 NOTREACHED(); | |
| 249 return; | 245 return; |
| 250 } | 246 } |
| 251 chrome::NavigateParams params( | 247 |
| 252 chrome::GetSingletonTabNavigateParams( | 248 DCHECK_EQ(manage_shortcut_, source); |
| 253 browser_, GURL(configure_url.c_str()))); | 249 |
| 250 std::string configure_url = chrome::kChromeUIExtensionsURL; |
| 251 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
| 252 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| 253 browser_, GURL(configure_url))); |
| 254 chrome::Navigate(¶ms); | 254 chrome::Navigate(¶ms); |
| 255 } | 255 } |
| 256 | 256 |
| 257 private: | 257 private: |
| 258 enum Flavors { | 258 enum Flavors { |
| 259 NONE = 0, | 259 NONE = 0, |
| 260 HOW_TO_USE = 1 << 0, | 260 HOW_TO_USE = 1 << 0, |
| 261 HOW_TO_MANAGE = 1 << 1, | 261 HOW_TO_MANAGE = 1 << 1, |
| 262 SHOW_KEYBINDING = 1 << 2, | 262 SHOW_KEYBINDING = 1 << 2, |
| 263 SIGN_IN_PROMO = 1 << 3, | 263 SIGN_IN_PROMO = 1 << 3, |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && | 594 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && |
| 595 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { | 595 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { |
| 596 BrowserView* browser_view = | 596 BrowserView* browser_view = |
| 597 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); | 597 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); |
| 598 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 598 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
| 599 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> | 599 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> |
| 600 GetPageAction(*bubble_.extension()), | 600 GetPageAction(*bubble_.extension()), |
| 601 false); // preview_enabled | 601 false); // preview_enabled |
| 602 } | 602 } |
| 603 } | 603 } |
| OLD | NEW |