Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc

Issue 777143003: Clean up straggler classes to use embedded signin in page in the new profiles world. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 81
81 } // namespace chrome 82 } // namespace chrome
82 83
83 // InstalledBubbleContent is the content view which is placed in the 84 // InstalledBubbleContent is the content view which is placed in the
84 // ExtensionInstalledBubbleView. It displays the install icon and explanatory 85 // ExtensionInstalledBubbleView. It displays the install icon and explanatory
85 // text about the installed extension. 86 // text about the installed extension.
86 class InstalledBubbleContent : public views::View, 87 class InstalledBubbleContent : public views::View,
87 public views::ButtonListener, 88 public views::ButtonListener,
88 public views::LinkListener { 89 public views::LinkListener {
89 public: 90 public:
90 InstalledBubbleContent(Browser* browser, 91 InstalledBubbleContent(Browser* browser,
Peter Kasting 2014/12/12 21:43:05 Nit: While here, consider separating the implement
noms (inactive) 2014/12/16 16:55:50 I will do it in a followup CL and send it over for
91 const Extension* extension, 92 const Extension* extension,
92 ExtensionInstalledBubble::BubbleType type, 93 ExtensionInstalledBubble::BubbleType type,
93 const SkBitmap* icon) 94 const SkBitmap* icon)
94 : browser_(browser), 95 : browser_(browser),
95 extension_id_(extension->id()), 96 extension_id_(extension->id()),
96 type_(type), 97 type_(type),
97 flavors_(NONE), 98 flavors_(NONE),
98 height_of_signin_promo_(0u), 99 height_of_signin_promo_(0u),
99 how_to_use_(NULL), 100 how_to_use_(NULL),
100 sign_in_link_(NULL), 101 sign_in_link_(NULL),
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 235 }
235 236
236 void ButtonPressed(views::Button* sender, const ui::Event& event) override { 237 void ButtonPressed(views::Button* sender, const ui::Event& event) override {
237 DCHECK_EQ(sender, close_button_); 238 DCHECK_EQ(sender, close_button_);
238 GetWidget()->Close(); 239 GetWidget()->Close();
239 } 240 }
240 241
241 // Implements the views::LinkListener interface. 242 // Implements the views::LinkListener interface.
242 void LinkClicked(views::Link* source, int event_flags) override { 243 void LinkClicked(views::Link* source, int event_flags) override {
243 GetWidget()->Close(); 244 GetWidget()->Close();
244 std::string configure_url;
245 if (source == manage_shortcut_) { 245 if (source == manage_shortcut_) {
246 configure_url = chrome::kChromeUIExtensionsURL; 246 std::string configure_url = chrome::kChromeUIExtensionsURL;
247 configure_url += chrome::kExtensionConfigureCommandsSubPage; 247 configure_url += chrome::kExtensionConfigureCommandsSubPage;
248 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams(
249 browser_, GURL(configure_url.c_str())));
Peter Kasting 2014/12/12 21:43:05 Remove .c_str() here, since GURL's constructor act
noms (inactive) 2014/12/16 16:55:50 Done.
250 chrome::Navigate(&params);
248 } else if (source == sign_in_link_) { 251 } else if (source == sign_in_link_) {
Peter Kasting 2014/12/12 21:43:05 Nit: While here, I might just do: if (source ==
noms (inactive) 2014/12/16 16:55:50 Done.
249 configure_url = signin::GetPromoURL( 252 chrome::ShowBrowserSignin(browser_,
250 signin::SOURCE_EXTENSION_INSTALL_BUBBLE, false).spec(); 253 signin::SOURCE_EXTENSION_INSTALL_BUBBLE);
251 } else { 254 } else {
252 NOTREACHED(); 255 NOTREACHED();
253 return; 256 return;
254 } 257 }
255 chrome::NavigateParams params(
256 chrome::GetSingletonTabNavigateParams(
257 browser_, GURL(configure_url.c_str())));
258 chrome::Navigate(&params);
259 } 258 }
260 259
261 private: 260 private:
262 enum Flavors { 261 enum Flavors {
263 NONE = 0, 262 NONE = 0,
264 HOW_TO_USE = 1 << 0, 263 HOW_TO_USE = 1 << 0,
265 HOW_TO_MANAGE = 1 << 1, 264 HOW_TO_MANAGE = 1 << 1,
266 SHOW_KEYBINDING = 1 << 2, 265 SHOW_KEYBINDING = 1 << 2,
267 SIGN_IN_PROMO = 1 << 3, 266 SIGN_IN_PROMO = 1 << 3,
268 }; 267 };
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && 597 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION &&
599 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { 598 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) {
600 BrowserView* browser_view = 599 BrowserView* browser_view =
601 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); 600 BrowserView::GetBrowserViewForBrowser(bubble_.browser());
602 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( 601 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
603 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> 602 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())->
604 GetPageAction(*bubble_.extension()), 603 GetPageAction(*bubble_.extension()),
605 false); // preview_enabled 604 false); // preview_enabled
606 } 605 }
607 } 606 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698