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

Side by Side Diff: extensions/shell/browser/shell_native_app_window.cc

Issue 587913002: app_shell: Remove some NOTIMPLEMENTED from ShellNativeAppWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « extensions/shell/browser/shell_app_window_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "extensions/shell/browser/shell_native_app_window.h" 5 #include "extensions/shell/browser/shell_native_app_window.h"
6 6
7 #include "content/public/browser/web_contents.h" 7 #include "content/public/browser/web_contents.h"
8 #include "extensions/shell/browser/desktop_controller.h"
8 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/aura/window_tree_host.h"
9 #include "ui/gfx/geometry/insets.h" 11 #include "ui/gfx/geometry/insets.h"
10 #include "ui/gfx/geometry/point.h" 12 #include "ui/gfx/geometry/point.h"
11 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 #include "ui/wm/core/window_util.h"
13 16
14 namespace extensions { 17 namespace extensions {
18 namespace {
19
20 gfx::Size GetDesktopWindowSize() {
21 return DesktopController::instance()->GetHost()->window()->bounds().size();
22 }
23
24 } // namespace
15 25
16 ShellNativeAppWindow::ShellNativeAppWindow( 26 ShellNativeAppWindow::ShellNativeAppWindow(
17 AppWindow* app_window, 27 AppWindow* app_window,
18 const AppWindow::CreateParams& params) 28 const AppWindow::CreateParams& params)
19 : app_window_(app_window) { 29 : app_window_(app_window) {
20 gfx::Rect bounds = params.GetInitialWindowBounds(GetFrameInsets()); 30 gfx::Rect bounds = params.GetInitialWindowBounds(GetFrameInsets());
21 bool position_specified = 31 bool position_specified =
22 bounds.x() != AppWindow::BoundsSpecification::kUnspecifiedPosition && 32 bounds.x() != AppWindow::BoundsSpecification::kUnspecifiedPosition &&
23 bounds.y() != AppWindow::BoundsSpecification::kUnspecifiedPosition; 33 bounds.y() != AppWindow::BoundsSpecification::kUnspecifiedPosition;
24 if (!position_specified) 34 if (!position_specified)
25 bounds.set_origin(GetBounds().origin()); 35 bounds.set_origin(GetBounds().origin());
26 SetBounds(bounds); 36 SetBounds(bounds);
27 } 37 }
28 38
29 ShellNativeAppWindow::~ShellNativeAppWindow() { 39 ShellNativeAppWindow::~ShellNativeAppWindow() {
30 } 40 }
31 41
32 bool ShellNativeAppWindow::IsActive() const { 42 bool ShellNativeAppWindow::IsActive() const {
33 NOTIMPLEMENTED(); 43 // Even though app_shell only supports a single app window, there might be
34 return false; 44 // some sort of system-level dialog open and active.
45 aura::Window* window = GetWindow();
46 return window && wm::IsActiveWindow(window);
35 } 47 }
36 48
37 bool ShellNativeAppWindow::IsMaximized() const { 49 bool ShellNativeAppWindow::IsMaximized() const {
38 NOTIMPLEMENTED();
39 return false; 50 return false;
40 } 51 }
41 52
42 bool ShellNativeAppWindow::IsMinimized() const { 53 bool ShellNativeAppWindow::IsMinimized() const {
43 NOTIMPLEMENTED();
44 return false; 54 return false;
45 } 55 }
46 56
47 bool ShellNativeAppWindow::IsFullscreen() const { 57 bool ShellNativeAppWindow::IsFullscreen() const {
48 NOTIMPLEMENTED(); 58 // The window in app_shell is considered a "restored" window that happens to
59 // fill the display. This avoids special handling of fullscreen or maximized
60 // windows that app_shell doesn't need.
49 return false; 61 return false;
50 } 62 }
51 63
52 gfx::NativeWindow ShellNativeAppWindow::GetNativeWindow() { 64 gfx::NativeWindow ShellNativeAppWindow::GetNativeWindow() {
53 return GetWindow(); 65 return GetWindow();
54 } 66 }
55 67
56 gfx::Rect ShellNativeAppWindow::GetRestoredBounds() const { 68 gfx::Rect ShellNativeAppWindow::GetRestoredBounds() const {
57 NOTIMPLEMENTED(); 69 // app_shell windows cannot be maximized, so the current bounds are the
70 // restored bounds.
58 return GetBounds(); 71 return GetBounds();
59 } 72 }
60 73
61 ui::WindowShowState ShellNativeAppWindow::GetRestoredState() const { 74 ui::WindowShowState ShellNativeAppWindow::GetRestoredState() const {
62 NOTIMPLEMENTED();
63 return ui::SHOW_STATE_NORMAL; 75 return ui::SHOW_STATE_NORMAL;
64 } 76 }
65 77
66 gfx::Rect ShellNativeAppWindow::GetBounds() const { 78 gfx::Rect ShellNativeAppWindow::GetBounds() const {
67 return GetWindow()->GetBoundsInScreen(); 79 return GetWindow()->GetBoundsInScreen();
68 } 80 }
69 81
70 void ShellNativeAppWindow::Show() { 82 void ShellNativeAppWindow::Show() {
71 GetWindow()->Show(); 83 GetWindow()->Show();
72 } 84 }
73 85
74 void ShellNativeAppWindow::Hide() { 86 void ShellNativeAppWindow::Hide() {
75 GetWindow()->Hide(); 87 GetWindow()->Hide();
76 } 88 }
77 89
78 void ShellNativeAppWindow::ShowInactive() { 90 void ShellNativeAppWindow::ShowInactive() {
79 NOTIMPLEMENTED(); 91 NOTIMPLEMENTED();
80 } 92 }
81 93
82 void ShellNativeAppWindow::Close() { 94 void ShellNativeAppWindow::Close() {
83 app_window_->OnNativeClose(); 95 app_window_->OnNativeClose();
84 } 96 }
85 97
86 void ShellNativeAppWindow::Activate() { 98 void ShellNativeAppWindow::Activate() {
87 NOTIMPLEMENTED(); 99 aura::Window* window = GetWindow();
100 if (window)
101 wm::ActivateWindow(window);
88 } 102 }
89 103
90 void ShellNativeAppWindow::Deactivate() { 104 void ShellNativeAppWindow::Deactivate() {
91 NOTIMPLEMENTED(); 105 aura::Window* window = GetWindow();
106 if (window)
107 wm::DeactivateWindow(window);
92 } 108 }
93 109
94 void ShellNativeAppWindow::Maximize() { 110 void ShellNativeAppWindow::Maximize() {
95 NOTIMPLEMENTED(); 111 NOTIMPLEMENTED();
96 } 112 }
97 113
98 void ShellNativeAppWindow::Minimize() { 114 void ShellNativeAppWindow::Minimize() {
99 NOTIMPLEMENTED(); 115 NOTIMPLEMENTED();
100 } 116 }
101 117
102 void ShellNativeAppWindow::Restore() { 118 void ShellNativeAppWindow::Restore() {
103 NOTIMPLEMENTED(); 119 NOTIMPLEMENTED();
104 } 120 }
105 121
106 void ShellNativeAppWindow::SetBounds(const gfx::Rect& bounds) { 122 void ShellNativeAppWindow::SetBounds(const gfx::Rect& bounds) {
107 GetWindow()->SetBounds(bounds); 123 GetWindow()->SetBounds(bounds);
108 } 124 }
109 125
110 void ShellNativeAppWindow::FlashFrame(bool flash) { 126 void ShellNativeAppWindow::FlashFrame(bool flash) {
111 NOTIMPLEMENTED(); 127 NOTIMPLEMENTED();
112 } 128 }
113 129
114 bool ShellNativeAppWindow::IsAlwaysOnTop() const { 130 bool ShellNativeAppWindow::IsAlwaysOnTop() const {
115 NOTIMPLEMENTED();
116 return false; 131 return false;
117 } 132 }
118 133
119 void ShellNativeAppWindow::SetAlwaysOnTop(bool always_on_top) { 134 void ShellNativeAppWindow::SetAlwaysOnTop(bool always_on_top) {
120 NOTIMPLEMENTED(); 135 NOTIMPLEMENTED();
121 } 136 }
122 137
123 gfx::NativeView ShellNativeAppWindow::GetHostView() const { 138 gfx::NativeView ShellNativeAppWindow::GetHostView() const {
124 NOTIMPLEMENTED(); 139 NOTIMPLEMENTED();
125 return NULL; 140 return NULL;
(...skipping 17 matching lines...) Expand all
143 gfx::Size ShellNativeAppWindow::GetMaximumDialogSize() { 158 gfx::Size ShellNativeAppWindow::GetMaximumDialogSize() {
144 NOTIMPLEMENTED(); 159 NOTIMPLEMENTED();
145 return gfx::Size(); 160 return gfx::Size();
146 } 161 }
147 162
148 void ShellNativeAppWindow::SetFullscreen(int fullscreen_types) { 163 void ShellNativeAppWindow::SetFullscreen(int fullscreen_types) {
149 NOTIMPLEMENTED(); 164 NOTIMPLEMENTED();
150 } 165 }
151 166
152 bool ShellNativeAppWindow::IsFullscreenOrPending() const { 167 bool ShellNativeAppWindow::IsFullscreenOrPending() const {
153 NOTIMPLEMENTED(); 168 // See comment in IsFullscreen().
154 return false; 169 return false;
155 } 170 }
156 171
157 void ShellNativeAppWindow::UpdateWindowIcon() { 172 void ShellNativeAppWindow::UpdateWindowIcon() {
158 NOTIMPLEMENTED(); 173 // No icon to update.
159 } 174 }
160 175
161 void ShellNativeAppWindow::UpdateWindowTitle() { 176 void ShellNativeAppWindow::UpdateWindowTitle() {
162 NOTIMPLEMENTED(); 177 // No window title to update.
163 } 178 }
164 179
165 void ShellNativeAppWindow::UpdateBadgeIcon() { 180 void ShellNativeAppWindow::UpdateBadgeIcon() {
166 NOTIMPLEMENTED(); 181 // No badge to update.
167 } 182 }
168 183
169 void ShellNativeAppWindow::UpdateDraggableRegions( 184 void ShellNativeAppWindow::UpdateDraggableRegions(
170 const std::vector<DraggableRegion>& regions) { 185 const std::vector<DraggableRegion>& regions) {
171 NOTIMPLEMENTED(); 186 NOTIMPLEMENTED();
172 } 187 }
173 188
174 SkRegion* ShellNativeAppWindow::GetDraggableRegion() { 189 SkRegion* ShellNativeAppWindow::GetDraggableRegion() {
175 NOTIMPLEMENTED(); 190 NOTIMPLEMENTED();
176 return NULL; 191 return NULL;
177 } 192 }
178 193
179 void ShellNativeAppWindow::UpdateShape(scoped_ptr<SkRegion> region) { 194 void ShellNativeAppWindow::UpdateShape(scoped_ptr<SkRegion> region) {
180 NOTIMPLEMENTED(); 195 NOTIMPLEMENTED();
181 } 196 }
182 197
183 void ShellNativeAppWindow::HandleKeyboardEvent( 198 void ShellNativeAppWindow::HandleKeyboardEvent(
184 const content::NativeWebKeyboardEvent& event) { 199 const content::NativeWebKeyboardEvent& event) {
185 NOTIMPLEMENTED(); 200 // No special handling. The WebContents will handle it.
186 } 201 }
187 202
188 bool ShellNativeAppWindow::IsFrameless() const { 203 bool ShellNativeAppWindow::IsFrameless() const {
189 NOTIMPLEMENTED(); 204 NOTIMPLEMENTED();
190 return false; 205 return false;
191 } 206 }
192 207
193 bool ShellNativeAppWindow::HasFrameColor() const { 208 bool ShellNativeAppWindow::HasFrameColor() const {
194 NOTIMPLEMENTED();
195 return false; 209 return false;
196 } 210 }
197 211
198 SkColor ShellNativeAppWindow::ActiveFrameColor() const { 212 SkColor ShellNativeAppWindow::ActiveFrameColor() const {
199 NOTIMPLEMENTED();
200 return SkColor(); 213 return SkColor();
201 } 214 }
202 215
203 SkColor ShellNativeAppWindow::InactiveFrameColor() const { 216 SkColor ShellNativeAppWindow::InactiveFrameColor() const {
204 NOTIMPLEMENTED();
205 return SkColor(); 217 return SkColor();
206 } 218 }
207 219
208 gfx::Insets ShellNativeAppWindow::GetFrameInsets() const { 220 gfx::Insets ShellNativeAppWindow::GetFrameInsets() const {
209 NOTIMPLEMENTED();
210 return gfx::Insets(); 221 return gfx::Insets();
211 } 222 }
212 223
213 void ShellNativeAppWindow::ShowWithApp() { 224 void ShellNativeAppWindow::ShowWithApp() {
214 NOTIMPLEMENTED(); 225 NOTIMPLEMENTED();
215 } 226 }
216 227
217 void ShellNativeAppWindow::HideWithApp() { 228 void ShellNativeAppWindow::HideWithApp() {
218 NOTIMPLEMENTED(); 229 NOTIMPLEMENTED();
219 } 230 }
220 231
221 void ShellNativeAppWindow::UpdateShelfMenu() { 232 void ShellNativeAppWindow::UpdateShelfMenu() {
222 NOTIMPLEMENTED(); 233 // app_shell has no shelf, dock, or system-tray to update.
223 } 234 }
224 235
225 gfx::Size ShellNativeAppWindow::GetContentMinimumSize() const { 236 gfx::Size ShellNativeAppWindow::GetContentMinimumSize() const {
226 NOTIMPLEMENTED(); 237 // Content fills the desktop and cannot be resized.
227 return gfx::Size(); 238 return GetDesktopWindowSize();
228 } 239 }
229 240
230 gfx::Size ShellNativeAppWindow::GetContentMaximumSize() const { 241 gfx::Size ShellNativeAppWindow::GetContentMaximumSize() const {
231 NOTIMPLEMENTED(); 242 // Content fills the desktop and cannot be resized.
232 return gfx::Size(); 243 return GetDesktopWindowSize();
233 } 244 }
234 245
235 void ShellNativeAppWindow::SetContentSizeConstraints( 246 void ShellNativeAppWindow::SetContentSizeConstraints(
236 const gfx::Size& min_size, 247 const gfx::Size& min_size,
237 const gfx::Size& max_size) { 248 const gfx::Size& max_size) {
238 NOTIMPLEMENTED(); 249 NOTIMPLEMENTED();
239 } 250 }
240 251
241 void ShellNativeAppWindow::SetVisibleOnAllWorkspaces(bool always_visible) { 252 void ShellNativeAppWindow::SetVisibleOnAllWorkspaces(bool always_visible) {
242 NOTIMPLEMENTED(); 253 NOTIMPLEMENTED();
243 } 254 }
244 255
245 bool ShellNativeAppWindow::CanHaveAlphaEnabled() const { 256 bool ShellNativeAppWindow::CanHaveAlphaEnabled() const {
246 NOTIMPLEMENTED(); 257 // No background to display if the window was transparent.
247 return false; 258 return false;
248 } 259 }
249 260
250 aura::Window* ShellNativeAppWindow::GetWindow() const { 261 aura::Window* ShellNativeAppWindow::GetWindow() const {
251 return app_window_->web_contents()->GetNativeView(); 262 return app_window_->web_contents()->GetNativeView();
252 } 263 }
253 264
254 } // namespace extensions 265 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_app_window_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698