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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views.h

Issue 11044020: Make Web Intents picker in Views conform to latest mocks (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments Created 8 years, 2 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_CONSTRAINED_WINDOW_VIEWS_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/ui/constrained_window.h" 9 #include "chrome/browser/ui/constrained_window.h"
10 #include "chrome/browser/ui/views/constrained_window_frame_simple.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
10 #include "content/public/browser/web_contents_observer.h" 13 #include "content/public/browser/web_contents_observer.h"
11 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
12 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
13 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
14 17
15 namespace content { 18 namespace content {
16 class WebContents; 19 class WebContents;
17 } 20 }
18 namespace views { 21 namespace views {
19 namespace internal { 22 namespace internal {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 /////////////////////////////////////////////////////////////////////////////// 55 ///////////////////////////////////////////////////////////////////////////////
53 // ConstrainedWindowViews 56 // ConstrainedWindowViews
54 // 57 //
55 // A ConstrainedWindow implementation that implements a Constrained Window as 58 // A ConstrainedWindow implementation that implements a Constrained Window as
56 // a child HWND with a custom window frame. The ConstrainedWindowViews owns 59 // a child HWND with a custom window frame. The ConstrainedWindowViews owns
57 // itself and will be deleted soon after being closed. 60 // itself and will be deleted soon after being closed.
58 // 61 //
59 class ConstrainedWindowViews : public views::Widget, 62 class ConstrainedWindowViews : public views::Widget,
60 public ConstrainedWindow, 63 public ConstrainedWindow,
61 public NativeConstrainedWindowDelegate, 64 public NativeConstrainedWindowDelegate,
62 public content::WebContentsObserver { 65 public content::WebContentsObserver,
66 public content::NotificationObserver {
63 public: 67 public:
68 // Types of insets to use with chrome style frame.
69 enum ChromeStyleClientInsets {
70 DEFAULT_INSETS,
71 NO_INSETS,
72 };
73
64 ConstrainedWindowViews(content::WebContents* web_contents, 74 ConstrainedWindowViews(content::WebContents* web_contents,
65 views::WidgetDelegate* widget_delegate, 75 views::WidgetDelegate* widget_delegate,
66 bool enable_chrome_style); 76 bool enable_chrome_style,
77 ChromeStyleClientInsets chrome_style_client_insets);
67 virtual ~ConstrainedWindowViews(); 78 virtual ~ConstrainedWindowViews();
68 79
69 // Returns the WebContents that constrains this Constrained Window. 80 // Returns the WebContents that constrains this Constrained Window.
70 content::WebContents* owner() const { return web_contents_; } 81 content::WebContents* owner() const { return web_contents_; }
71 82
72 // Overridden from ConstrainedWindow: 83 // Overridden from ConstrainedWindow:
73 virtual void ShowConstrainedWindow() OVERRIDE; 84 virtual void ShowConstrainedWindow() OVERRIDE;
74 virtual void CloseConstrainedWindow() OVERRIDE; 85 virtual void CloseConstrainedWindow() OVERRIDE;
75 virtual void FocusConstrainedWindow() OVERRIDE; 86 virtual void FocusConstrainedWindow() OVERRIDE;
76 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; 87 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
77 88
78 // Overridden from views::Widget: 89 // Overridden from views::Widget:
79 void CenterWindow(const gfx::Size& size); 90 void CenterWindow(const gfx::Size& size);
80 91
92 // Default insets for the dialog:
93 static gfx::Insets GetDefaultInsets();
94
95 // Returns the type of insets to use with chrome style frame.
96 ChromeStyleClientInsets chrome_style_client_insets() {
Peter Kasting 2012/10/16 17:28:59 Nit: const If the ConstrainedWindowFrameSimple is
please use gerrit instead 2012/10/16 19:12:37 Done.
97 return chrome_style_client_insets_;
98 }
99
81 private: 100 private:
82 void NotifyTabHelperWillClose(); 101 void NotifyTabHelperWillClose();
83 102
84 // Overridden from views::Widget: 103 // Overridden from views::Widget:
85 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; 104 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
86 105
87 // Overridden from NativeConstrainedWindowDelegate: 106 // Overridden from NativeConstrainedWindowDelegate:
88 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; 107 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE;
89 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; 108 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE;
90 virtual views::internal::NativeWidgetDelegate* 109 virtual views::internal::NativeWidgetDelegate*
91 AsNativeWidgetDelegate() OVERRIDE; 110 AsNativeWidgetDelegate() OVERRIDE;
92 virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE; 111 virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE;
93 112
94 // Set the top of the window to overlap the browser chrome.
95 void PositionChromeStyleWindow();
96
97 // Overridden from content::WebContentsObserver: 113 // Overridden from content::WebContentsObserver:
98 virtual void WebContentsDestroyed(content::WebContents* web_contents) 114 virtual void WebContentsDestroyed(content::WebContents* web_contents)
99 OVERRIDE; 115 OVERRIDE;
100 116
117 // Overridden from content::NotificationObserver:
118 virtual void Observe(int type,
119 const content::NotificationSource& source,
120 const content::NotificationDetails& details) OVERRIDE;
121
122 // Set the top of the window to overlap the browser chrome.
123 void PositionChromeStyleWindow(const gfx::Size& size);
124
125 content::NotificationRegistrar registrar_;
101 content::WebContents* web_contents_; 126 content::WebContents* web_contents_;
102 127
103 NativeConstrainedWindow* native_constrained_window_;
104
105 // TODO(wittman): remove once all constrained window dialogs are moved 128 // TODO(wittman): remove once all constrained window dialogs are moved
106 // over to Chrome style. 129 // over to Chrome style.
107 const bool enable_chrome_style_; 130 const bool enable_chrome_style_;
108 131
132 // Client insets to use when |enable_chrome_style_| is true.
133 ChromeStyleClientInsets chrome_style_client_insets_;
134
135 NativeConstrainedWindow* native_constrained_window_;
136 ConstrainedWindowFrameSimple* chrome_style_frame_;
Peter Kasting 2012/10/16 17:28:59 Where is this used?
please use gerrit instead 2012/10/16 19:12:37 Removed unused member. Done.
137
109 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); 138 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews);
110 }; 139 };
111 140
112 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ 141 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698