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

Side by Side Diff: extensions/browser/app_window/app_window.cc

Issue 1914993002: Enhance chrome.app.window API with better shelf integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + Fixes v10 Created 4 years, 5 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 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/browser/app_window/app_window.h" 5 #include "extensions/browser/app_window/app_window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 active_frame_color(SK_ColorBLACK), 166 active_frame_color(SK_ColorBLACK),
167 inactive_frame_color(SK_ColorBLACK), 167 inactive_frame_color(SK_ColorBLACK),
168 alpha_enabled(false), 168 alpha_enabled(false),
169 is_ime_window(false), 169 is_ime_window(false),
170 creator_process_id(0), 170 creator_process_id(0),
171 state(ui::SHOW_STATE_DEFAULT), 171 state(ui::SHOW_STATE_DEFAULT),
172 hidden(false), 172 hidden(false),
173 resizable(true), 173 resizable(true),
174 focused(true), 174 focused(true),
175 always_on_top(false), 175 always_on_top(false),
176 visible_on_all_workspaces(false) { 176 visible_on_all_workspaces(false),
177 } 177 show_in_shelf(false) {}
178 178
179 AppWindow::CreateParams::CreateParams(const CreateParams& other) = default; 179 AppWindow::CreateParams::CreateParams(const CreateParams& other) = default;
180 180
181 AppWindow::CreateParams::~CreateParams() {} 181 AppWindow::CreateParams::~CreateParams() {}
182 182
183 gfx::Rect AppWindow::CreateParams::GetInitialWindowBounds( 183 gfx::Rect AppWindow::CreateParams::GetInitialWindowBounds(
184 const gfx::Insets& frame_insets) const { 184 const gfx::Insets& frame_insets) const {
185 // Combine into a single window bounds. 185 // Combine into a single window bounds.
186 gfx::Rect combined_bounds(window_spec.bounds); 186 gfx::Rect combined_bounds(window_spec.bounds);
187 if (content_spec.bounds.x() != BoundsSpecification::kUnspecifiedPosition) 187 if (content_spec.bounds.x() != BoundsSpecification::kUnspecifiedPosition)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 fullscreen_types_(FULLSCREEN_TYPE_NONE), 248 fullscreen_types_(FULLSCREEN_TYPE_NONE),
249 show_on_first_paint_(false), 249 show_on_first_paint_(false),
250 first_paint_complete_(false), 250 first_paint_complete_(false),
251 has_been_shown_(false), 251 has_been_shown_(false),
252 can_send_events_(false), 252 can_send_events_(false),
253 is_hidden_(false), 253 is_hidden_(false),
254 delayed_show_type_(SHOW_ACTIVE), 254 delayed_show_type_(SHOW_ACTIVE),
255 cached_always_on_top_(false), 255 cached_always_on_top_(false),
256 requested_alpha_enabled_(false), 256 requested_alpha_enabled_(false),
257 is_ime_window_(false), 257 is_ime_window_(false),
258 show_in_shelf_(false),
258 image_loader_ptr_factory_(this) { 259 image_loader_ptr_factory_(this) {
259 ExtensionsBrowserClient* client = ExtensionsBrowserClient::Get(); 260 ExtensionsBrowserClient* client = ExtensionsBrowserClient::Get();
260 CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord()) 261 CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord())
261 << "Only off the record window may be opened in the guest mode."; 262 << "Only off the record window may be opened in the guest mode.";
262 } 263 }
263 264
264 void AppWindow::Init(const GURL& url, 265 void AppWindow::Init(const GURL& url,
265 AppWindowContents* app_window_contents, 266 AppWindowContents* app_window_contents,
266 content::RenderFrameHost* creator_frame, 267 content::RenderFrameHost* creator_frame,
267 const CreateParams& params) { 268 const CreateParams& params) {
(...skipping 20 matching lines...) Expand all
288 CreateParams new_params = LoadDefaults(params); 289 CreateParams new_params = LoadDefaults(params);
289 window_type_ = new_params.window_type; 290 window_type_ = new_params.window_type;
290 window_key_ = new_params.window_key; 291 window_key_ = new_params.window_key;
291 292
292 // Windows cannot be always-on-top in fullscreen mode for security reasons. 293 // Windows cannot be always-on-top in fullscreen mode for security reasons.
293 cached_always_on_top_ = new_params.always_on_top; 294 cached_always_on_top_ = new_params.always_on_top;
294 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) 295 if (new_params.state == ui::SHOW_STATE_FULLSCREEN)
295 new_params.always_on_top = false; 296 new_params.always_on_top = false;
296 297
297 requested_alpha_enabled_ = new_params.alpha_enabled; 298 requested_alpha_enabled_ = new_params.alpha_enabled;
298
299 is_ime_window_ = params.is_ime_window; 299 is_ime_window_ = params.is_ime_window;
300 show_in_shelf_ = params.show_in_shelf;
300 301
301 AppWindowClient* app_window_client = AppWindowClient::Get(); 302 AppWindowClient* app_window_client = AppWindowClient::Get();
302 native_app_window_.reset( 303 native_app_window_.reset(
303 app_window_client->CreateNativeAppWindow(this, &new_params)); 304 app_window_client->CreateNativeAppWindow(this, &new_params));
304 305
305 helper_.reset(new AppWebContentsHelper( 306 helper_.reset(new AppWebContentsHelper(
306 browser_context_, extension_id_, web_contents(), app_delegate_.get())); 307 browser_context_, extension_id_, web_contents(), app_delegate_.get()));
307 308
308 UpdateExtensionAppIcon(); 309 UpdateExtensionAppIcon();
309 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); 310 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this);
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 region.bounds.x(), 1126 region.bounds.x(),
1126 region.bounds.y(), 1127 region.bounds.y(),
1127 region.bounds.right(), 1128 region.bounds.right(),
1128 region.bounds.bottom(), 1129 region.bounds.bottom(),
1129 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); 1130 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
1130 } 1131 }
1131 return sk_region; 1132 return sk_region;
1132 } 1133 }
1133 1134
1134 } // namespace extensions 1135 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/app_window/app_window.h ('k') | extensions/browser/app_window/app_window_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698