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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_popup.h

Issue 1808083002: Migrate ExtensionPopup from BubbleDelegateView to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU Created 4 years, 9 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
12 #include "chrome/browser/ui/views/extensions/extension_view_views.h" 12 #include "chrome/browser/ui/views/extensions/extension_view_views.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/views/bubble/bubble_delegate.h" 15 #include "ui/views/bubble/bubble_dialog_delegate.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 18
19 class Browser; 19 class Browser;
20 namespace views { 20 namespace views {
21 class Widget; 21 class Widget;
22 } 22 }
23 23
24 namespace content { 24 namespace content {
25 class DevToolsAgentHost; 25 class DevToolsAgentHost;
26 } 26 }
27 27
28 namespace extensions { 28 namespace extensions {
29 class ExtensionViewHost; 29 class ExtensionViewHost;
30 } 30 }
31 31
32 // The bubble used for hosting a browser-action popup provided by an extension. 32 // The bubble used for hosting a browser-action popup provided by an extension.
33 class ExtensionPopup : public views::BubbleDelegateView, 33 class ExtensionPopup : public views::BubbleDialogDelegateView,
34 public ExtensionViewViews::Container, 34 public ExtensionViewViews::Container,
35 public content::NotificationObserver, 35 public content::NotificationObserver,
36 public TabStripModelObserver { 36 public TabStripModelObserver {
37 public: 37 public:
38 enum ShowAction { 38 enum ShowAction {
39 SHOW, 39 SHOW,
40 SHOW_AND_INSPECT, 40 SHOW_AND_INSPECT,
41 }; 41 };
42 42
43 ~ExtensionPopup() override; 43 ~ExtensionPopup() override;
44 44
45 // Create and show a popup with the given |host| positioned adjacent to 45 // Create and show a popup with the given |host| positioned adjacent to
46 // |anchor_view|. 46 // |anchor_view|.
47 // The positioning of the pop-up is determined by |arrow| according to the 47 // The positioning of the pop-up is determined by |arrow| according to the
48 // following logic: The popup is anchored so that the corner indicated by the 48 // following logic: The popup is anchored so that the corner indicated by the
49 // value of |arrow| remains fixed during popup resizes. If |arrow| is 49 // value of |arrow| remains fixed during popup resizes. If |arrow| is
50 // BOTTOM_*, then the popup 'pops up', otherwise the popup 'drops down'. 50 // BOTTOM_*, then the popup 'pops up', otherwise the popup 'drops down'.
51 // The actual display of the popup is delayed until the page contents 51 // The actual display of the popup is delayed until the page contents
52 // finish loading in order to minimize UI flashing and resizing. 52 // finish loading in order to minimize UI flashing and resizing.
53 static ExtensionPopup* ShowPopup( 53 static ExtensionPopup* ShowPopup(
54 scoped_ptr<extensions::ExtensionViewHost> host, 54 scoped_ptr<extensions::ExtensionViewHost> host,
55 views::View* anchor_view, 55 views::View* anchor_view,
56 views::BubbleBorder::Arrow arrow, 56 views::BubbleBorder::Arrow arrow,
57 ShowAction show_action); 57 ShowAction show_action);
58 58
59 extensions::ExtensionViewHost* host() const { return host_.get(); }
59 60
60 extensions::ExtensionViewHost* host() const { return host_.get(); } 61 // views::BubbleDialogDelegateView overrides.
62 int GetDialogButtons() const override;
61 63
62 // content::NotificationObserver overrides. 64 // content::NotificationObserver overrides.
63 void Observe(int type, 65 void Observe(int type,
64 const content::NotificationSource& source, 66 const content::NotificationSource& source,
65 const content::NotificationDetails& details) override; 67 const content::NotificationDetails& details) override;
66 68
67 // ExtensionViewViews::Container overrides. 69 // ExtensionViewViews::Container overrides.
68 void OnExtensionSizeChanged(ExtensionViewViews* view) override; 70 void OnExtensionSizeChanged(ExtensionViewViews* view) override;
69 71
70 // views::View overrides. 72 // views::View overrides.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 content::NotificationRegistrar registrar_; 119 content::NotificationRegistrar registrar_;
118 120
119 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; 121 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_;
120 122
121 bool widget_initialized_; 123 bool widget_initialized_;
122 124
123 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); 125 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup);
124 }; 126 };
125 127
126 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ 128 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/simple_web_view_dialog.cc ('k') | chrome/browser/ui/views/extensions/extension_popup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698