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

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

Issue 119633002: Close ExtensionPopup on tab switches; add test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary NULL checks. Created 7 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 | Annotate | Revision Log
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 "chrome/browser/ui/tabs/tab_strip_model_observer.h"
10 #include "chrome/browser/ui/views/extensions/extension_view_views.h" 11 #include "chrome/browser/ui/views/extensions/extension_view_views.h"
11 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
13 #include "ui/views/bubble/bubble_delegate.h" 14 #include "ui/views/bubble/bubble_delegate.h"
14 #include "ui/views/focus/widget_focus_manager.h" 15 #include "ui/views/focus/widget_focus_manager.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 #if defined(USE_AURA) 18 #if defined(USE_AURA)
18 #include "ui/aura/client/activation_change_observer.h" 19 #include "ui/aura/client/activation_change_observer.h"
19 #endif 20 #endif
20 21
21 class Browser; 22 class Browser;
22 namespace views { 23 namespace views {
23 class Widget; 24 class Widget;
24 } 25 }
25 26
26 namespace content { 27 namespace content {
27 class DevToolsAgentHost; 28 class DevToolsAgentHost;
28 } 29 }
29 30
30 namespace extensions { 31 namespace extensions {
31 class ExtensionViewHost; 32 class ExtensionViewHost;
32 } 33 }
33 34
34 class ExtensionPopup : public views::BubbleDelegateView, 35 class ExtensionPopup : public views::BubbleDelegateView,
35 #if defined(USE_AURA) 36 #if defined(USE_AURA)
36 public aura::client::ActivationChangeObserver, 37 public aura::client::ActivationChangeObserver,
37 #endif 38 #endif
38 public ExtensionViewViews::Container, 39 public ExtensionViewViews::Container,
39 public content::NotificationObserver { 40 public content::NotificationObserver,
41 public TabStripModelObserver {
40 public: 42 public:
41 enum ShowAction { 43 enum ShowAction {
42 SHOW, 44 SHOW,
43 SHOW_AND_INSPECT 45 SHOW_AND_INSPECT
44 }; 46 };
45 47
46 virtual ~ExtensionPopup(); 48 virtual ~ExtensionPopup();
47 49
48 // Create and show a popup with |url| positioned adjacent to |anchor_view|. 50 // Create and show a popup with |url| positioned adjacent to |anchor_view|.
49 // |browser| is the browser to which the pop-up will be attached. NULL is a 51 // |browser| is the browser to which the pop-up will be attached. NULL is a
(...skipping 27 matching lines...) Expand all
77 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; 79 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
78 virtual void OnWidgetActivationChanged(views::Widget* widget, 80 virtual void OnWidgetActivationChanged(views::Widget* widget,
79 bool active) OVERRIDE; 81 bool active) OVERRIDE;
80 82
81 #if defined(USE_AURA) 83 #if defined(USE_AURA)
82 // aura::client::ActivationChangeObserver overrides. 84 // aura::client::ActivationChangeObserver overrides.
83 virtual void OnWindowActivated(aura::Window* gained_active, 85 virtual void OnWindowActivated(aura::Window* gained_active,
84 aura::Window* lost_active) OVERRIDE; 86 aura::Window* lost_active) OVERRIDE;
85 #endif 87 #endif
86 88
89 // TabStripModelObserver overrides.
90 virtual void ActiveTabChanged(content::WebContents* old_contents,
91 content::WebContents* new_contents,
92 int index,
93 int reason) OVERRIDE;
94
87 // The min/max height of popups. 95 // The min/max height of popups.
88 static const int kMinWidth; 96 static const int kMinWidth;
89 static const int kMinHeight; 97 static const int kMinHeight;
90 static const int kMaxWidth; 98 static const int kMaxWidth;
91 static const int kMaxHeight; 99 static const int kMaxHeight;
92 100
93 private: 101 private:
94 ExtensionPopup(extensions::ExtensionViewHost* host, 102 ExtensionPopup(extensions::ExtensionViewHost* host,
95 views::View* anchor_view, 103 views::View* anchor_view,
96 views::BubbleBorder::Arrow arrow, 104 views::BubbleBorder::Arrow arrow,
(...skipping 12 matching lines...) Expand all
109 bool inspect_with_devtools_; 117 bool inspect_with_devtools_;
110 118
111 content::NotificationRegistrar registrar_; 119 content::NotificationRegistrar registrar_;
112 120
113 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; 121 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_;
114 122
115 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); 123 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup);
116 }; 124 };
117 125
118 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ 126 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698