| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" | |
| 10 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" | |
| 11 #include "components/bubble/bubble_reference.h" | |
| 12 #include "ui/views/bubble/bubble_delegate.h" | |
| 13 #include "ui/views/controls/button/button.h" | |
| 14 #include "ui/views/controls/link_listener.h" | |
| 15 | |
| 16 class Browser; | |
| 17 class BubbleSyncPromoView; | |
| 18 | |
| 19 namespace extensions { | |
| 20 class Extension; | |
| 21 } | |
| 22 | |
| 23 namespace views { | |
| 24 class LabelButton; | |
| 25 class Link; | |
| 26 } | |
| 27 | |
| 28 // Provides feedback to the user upon successful installation of an | |
| 29 // extension. Depending on the type of extension, the Bubble will | |
| 30 // point to: | |
| 31 // OMNIBOX_KEYWORD-> The omnibox. | |
| 32 // BROWSER_ACTION -> The browserAction icon in the toolbar. | |
| 33 // PAGE_ACTION -> A preview of the pageAction icon in the location | |
| 34 // bar which is shown while the Bubble is shown. | |
| 35 // GENERIC -> The app menu. This case includes pageActions that don't | |
| 36 // specify a default icon. | |
| 37 class ExtensionInstalledBubbleView : public BubbleSyncPromoDelegate, | |
| 38 public views::BubbleDelegateView, | |
| 39 public views::ButtonListener, | |
| 40 public views::LinkListener { | |
| 41 public: | |
| 42 ExtensionInstalledBubbleView(ExtensionInstalledBubble* bubble, | |
| 43 BubbleReference bubble_reference); | |
| 44 ~ExtensionInstalledBubbleView() override; | |
| 45 | |
| 46 // Recalculate the anchor position for this bubble. | |
| 47 void UpdateAnchorView(); | |
| 48 | |
| 49 void InitLayout(); | |
| 50 | |
| 51 private: | |
| 52 // views::BubbleDelegateView: | |
| 53 View* CreateFootnoteView() override; | |
| 54 void WindowClosing() override; | |
| 55 gfx::Rect GetAnchorRect() const override; | |
| 56 void OnWidgetClosing(views::Widget* widget) override; | |
| 57 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; | |
| 58 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | |
| 59 | |
| 60 // BubbleSyncPromoDelegate: | |
| 61 void OnSignInLinkClicked() override; | |
| 62 | |
| 63 // views::LinkListener: | |
| 64 void LinkClicked(views::Link* source, int event_flags) override; | |
| 65 | |
| 66 // views::ButtonListener: | |
| 67 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
| 68 | |
| 69 const ExtensionInstalledBubble* bubble_; | |
| 70 BubbleReference bubble_reference_; | |
| 71 const extensions::Extension* extension_; | |
| 72 Browser* browser_; | |
| 73 ExtensionInstalledBubble::BubbleType type_; | |
| 74 ExtensionInstalledBubble::AnchorPosition anchor_position_; | |
| 75 | |
| 76 // The button to close the bubble. | |
| 77 views::LabelButton* close_; | |
| 78 | |
| 79 // The shortcut to open the manage shortcuts page. | |
| 80 views::Link* manage_shortcut_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleView); | |
| 83 }; | |
| 84 | |
| 85 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ | |
| OLD | NEW |