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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/ui/views/frame/browser_view.h" | 23 #include "chrome/browser/ui/views/frame/browser_view.h" |
24 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 24 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
25 #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" |
26 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 26 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
27 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" | 27 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" |
28 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 28 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
29 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 29 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
30 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" | 30 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" |
31 #include "chrome/common/extensions/sync_helper.h" | 31 #include "chrome/common/extensions/sync_helper.h" |
32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "chrome/grit/chromium_strings.h" |
| 34 #include "chrome/grit/generated_resources.h" |
33 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
34 #include "grit/chromium_strings.h" | |
35 #include "grit/generated_resources.h" | |
36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
37 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
38 #include "ui/gfx/render_text.h" | 38 #include "ui/gfx/render_text.h" |
39 #include "ui/gfx/text_elider.h" | 39 #include "ui/gfx/text_elider.h" |
40 #include "ui/resources/grit/ui_resources.h" | 40 #include "ui/resources/grit/ui_resources.h" |
41 #include "ui/views/controls/button/image_button.h" | 41 #include "ui/views/controls/button/image_button.h" |
42 #include "ui/views/controls/image_view.h" | 42 #include "ui/views/controls/image_view.h" |
43 #include "ui/views/controls/label.h" | 43 #include "ui/views/controls/label.h" |
44 #include "ui/views/controls/link.h" | 44 #include "ui/views/controls/link.h" |
45 #include "ui/views/controls/link_listener.h" | 45 #include "ui/views/controls/link_listener.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 NOTREACHED(); | 253 NOTREACHED(); |
254 return; | 254 return; |
255 } | 255 } |
256 chrome::NavigateParams params( | 256 chrome::NavigateParams params( |
257 chrome::GetSingletonTabNavigateParams( | 257 chrome::GetSingletonTabNavigateParams( |
258 browser_, GURL(configure_url.c_str()))); | 258 browser_, GURL(configure_url.c_str()))); |
259 chrome::Navigate(¶ms); | 259 chrome::Navigate(¶ms); |
260 } | 260 } |
261 | 261 |
262 private: | 262 private: |
263 enum Flavors { | 263 enum Flavors { |
264 NONE = 0, | 264 NONE = 0, |
265 HOW_TO_USE = 1 << 0, | 265 HOW_TO_USE = 1 << 0, |
266 HOW_TO_MANAGE = 1 << 1, | 266 HOW_TO_MANAGE = 1 << 1, |
267 SHOW_KEYBINDING = 1 << 2, | 267 SHOW_KEYBINDING = 1 << 2, |
268 SIGN_IN_PROMO = 1 << 3, | 268 SIGN_IN_PROMO = 1 << 3, |
269 }; | 269 }; |
270 | 270 |
271 bool GetKeybinding(extensions::Command* command) { | 271 bool GetKeybinding(extensions::Command* command) { |
272 extensions::CommandService* command_service = | 272 extensions::CommandService* command_service = |
273 extensions::CommandService::Get(browser_->profile()); | 273 extensions::CommandService::Get(browser_->profile()); |
274 if (type_ == ExtensionInstalledBubble::BROWSER_ACTION) { | 274 if (type_ == ExtensionInstalledBubble::BROWSER_ACTION) { |
275 return command_service->GetBrowserActionCommand( | 275 return command_service->GetBrowserActionCommand( |
276 extension_id_, | 276 extension_id_, |
277 extensions::CommandService::ACTIVE_ONLY, | 277 extensions::CommandService::ACTIVE_ONLY, |
278 command, | 278 command, |
279 NULL); | 279 NULL); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 views::Label* how_to_use_; | 505 views::Label* how_to_use_; |
506 views::Link* sign_in_link_; | 506 views::Link* sign_in_link_; |
507 views::Label* manage_; | 507 views::Label* manage_; |
508 views::Link* manage_shortcut_; | 508 views::Link* manage_shortcut_; |
509 views::ImageButton* close_button_; | 509 views::ImageButton* close_button_; |
510 | 510 |
511 DISALLOW_COPY_AND_ASSIGN(InstalledBubbleContent); | 511 DISALLOW_COPY_AND_ASSIGN(InstalledBubbleContent); |
512 }; | 512 }; |
513 | 513 |
514 void ExtensionInstalledBubbleView::Show(const Extension* extension, | 514 void ExtensionInstalledBubbleView::Show(const Extension* extension, |
515 Browser *browser, | 515 Browser* browser, |
516 const SkBitmap& icon) { | 516 const SkBitmap& icon) { |
517 new ExtensionInstalledBubbleView(extension, browser, icon); | 517 new ExtensionInstalledBubbleView(extension, browser, icon); |
518 } | 518 } |
519 | 519 |
520 ExtensionInstalledBubbleView::ExtensionInstalledBubbleView( | 520 ExtensionInstalledBubbleView::ExtensionInstalledBubbleView( |
521 const Extension* extension, Browser *browser, const SkBitmap& icon) | 521 const Extension* extension, Browser *browser, const SkBitmap& icon) |
522 : bubble_(this, extension, browser, icon) { | 522 : bubble_(this, extension, browser, icon) { |
523 } | 523 } |
524 | 524 |
525 ExtensionInstalledBubbleView::~ExtensionInstalledBubbleView() {} | 525 ExtensionInstalledBubbleView::~ExtensionInstalledBubbleView() {} |
526 | 526 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 void ExtensionInstalledBubbleView::WindowClosing() { | 599 void ExtensionInstalledBubbleView::WindowClosing() { |
600 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION) { | 600 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION) { |
601 BrowserView* browser_view = | 601 BrowserView* browser_view = |
602 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); | 602 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); |
603 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 603 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
604 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> | 604 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> |
605 GetPageAction(*bubble_.extension()), | 605 GetPageAction(*bubble_.extension()), |
606 false); // preview_enabled | 606 false); // preview_enabled |
607 } | 607 } |
608 } | 608 } |
OLD | NEW |