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

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

Issue 454019: Addition of optional giveFocus parameter to experimental.popup.show(...) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ 5 #ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ 6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
7 7
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/views/browser_bubble.h" 9 #include "chrome/browser/views/browser_bubble.h"
10 #include "chrome/browser/views/extensions/extension_view.h" 10 #include "chrome/browser/views/extensions/extension_view.h"
(...skipping 11 matching lines...) Expand all
22 public: 22 public:
23 virtual ~ExtensionPopup(); 23 virtual ~ExtensionPopup();
24 24
25 // Create and show a popup with |url| positioned adjacent to |relative_to| in 25 // Create and show a popup with |url| positioned adjacent to |relative_to| in
26 // screen coordinates. 26 // screen coordinates.
27 // The positioning of the pop-up is determined by |arrow_location| according 27 // The positioning of the pop-up is determined by |arrow_location| according
28 // to the following logic: The popup is anchored so that the corner indicated 28 // to the following logic: The popup is anchored so that the corner indicated
29 // by value of |arrow_location| remains fixed during popup resizes. 29 // by value of |arrow_location| remains fixed during popup resizes.
30 // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise 30 // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise
31 // the popup 'drops down'. 31 // the popup 'drops down'.
32 // Pass |activate_on_show| as true to activate the popup window.
32 // 33 //
33 // The actual display of the popup is delayed until the page contents 34 // The actual display of the popup is delayed until the page contents
34 // finish loading in order to minimize UI flashing and resizing. 35 // finish loading in order to minimize UI flashing and resizing.
35 static ExtensionPopup* Show(const GURL& url, Browser* browser, 36 static ExtensionPopup* Show(const GURL& url, Browser* browser,
36 const gfx::Rect& relative_to, 37 const gfx::Rect& relative_to,
37 BubbleBorder::ArrowLocation arrow_location); 38 BubbleBorder::ArrowLocation arrow_location,
39 bool activate_on_show);
38 40
39 ExtensionHost* host() const { return extension_host_.get(); } 41 ExtensionHost* host() const { return extension_host_.get(); }
40 42
41 // BrowserBubble overrides. 43 // BrowserBubble overrides.
42 virtual void Hide(); 44 virtual void Hide();
43 virtual void Show(); 45 virtual void Show(bool activate);
44 virtual void ResizeToView(); 46 virtual void ResizeToView();
45 47
46 // NotificationObserver overrides. 48 // NotificationObserver overrides.
47 virtual void Observe(NotificationType type, 49 virtual void Observe(NotificationType type,
48 const NotificationSource& source, 50 const NotificationSource& source,
49 const NotificationDetails& details); 51 const NotificationDetails& details);
50 52
51 // ExtensionView::Container overrides. 53 // ExtensionView::Container overrides.
52 virtual void OnExtensionMouseEvent(ExtensionView* view) { } 54 virtual void OnExtensionMouseEvent(ExtensionView* view) { }
53 virtual void OnExtensionMouseLeave(ExtensionView* view) { } 55 virtual void OnExtensionMouseLeave(ExtensionView* view) { }
54 virtual void OnExtensionPreferredSizeChanged(ExtensionView* view); 56 virtual void OnExtensionPreferredSizeChanged(ExtensionView* view);
55 57
56 // The min/max height of popups. 58 // The min/max height of popups.
57 static const int kMinWidth; 59 static const int kMinWidth;
58 static const int kMinHeight; 60 static const int kMinHeight;
59 static const int kMaxWidth; 61 static const int kMaxWidth;
60 static const int kMaxHeight; 62 static const int kMaxHeight;
61 63
62 private: 64 private:
63 ExtensionPopup(ExtensionHost* host, 65 ExtensionPopup(ExtensionHost* host,
64 views::Widget* frame, 66 views::Widget* frame,
65 const gfx::Rect& relative_to, 67 const gfx::Rect& relative_to,
66 BubbleBorder::ArrowLocation); 68 BubbleBorder::ArrowLocation arrow_location,
69 bool activate_on_show);
67 70
68 // The area on the screen that the popup should be positioned relative to. 71 // The area on the screen that the popup should be positioned relative to.
69 gfx::Rect relative_to_; 72 gfx::Rect relative_to_;
70 73
71 // The contained host for the view. 74 // The contained host for the view.
72 scoped_ptr<ExtensionHost> extension_host_; 75 scoped_ptr<ExtensionHost> extension_host_;
73 76
77 // Flag used to indicate if the pop-up should be activated upon first display.
78 bool activate_on_show_;
79
74 NotificationRegistrar registrar_; 80 NotificationRegistrar registrar_;
75 81
76 // A separate widget and associated pieces to draw a border behind the 82 // A separate widget and associated pieces to draw a border behind the
77 // popup. This has to be a separate window in order to support transparency. 83 // popup. This has to be a separate window in order to support transparency.
78 // Layered windows can't contain native child windows, so we wouldn't be 84 // Layered windows can't contain native child windows, so we wouldn't be
79 // able to have the ExtensionView child. 85 // able to have the ExtensionView child.
80 views::Widget* border_widget_; 86 views::Widget* border_widget_;
81 BubbleBorder* border_; 87 BubbleBorder* border_;
82 views::View* border_view_; 88 views::View* border_view_;
83 89
84 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); 90 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup);
85 }; 91 };
86 92
87 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ 93 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698