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

Side by Side Diff: chrome/browser/extensions/api/app_window/app_window_api.cc

Issue 267303003: Promote chrome app window frame color to stable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 #include "chrome/browser/extensions/api/app_window/app_window_api.h" 5 #include "chrome/browser/extensions/api/app_window/app_window_api.h"
6 6
7 #include "apps/app_window.h" 7 #include "apps/app_window.h"
8 #include "apps/app_window_contents.h" 8 #include "apps/app_window_contents.h"
9 #include "apps/app_window_registry.h" 9 #include "apps/app_window_registry.h"
10 #include "apps/apps_client.h" 10 #include "apps/apps_client.h"
(...skipping 26 matching lines...) Expand all
37 namespace Create = app_window::Create; 37 namespace Create = app_window::Create;
38 38
39 namespace extensions { 39 namespace extensions {
40 40
41 namespace app_window_constants { 41 namespace app_window_constants {
42 const char kInvalidWindowId[] = 42 const char kInvalidWindowId[] =
43 "The window id can not be more than 256 characters long."; 43 "The window id can not be more than 256 characters long.";
44 const char kInvalidColorSpecification[] = 44 const char kInvalidColorSpecification[] =
45 "The color specification could not be parsed."; 45 "The color specification could not be parsed.";
46 const char kInvalidChannelForFrameOptions[] = 46 const char kInvalidChannelForFrameOptions[] =
47 "Frame options are only available in dev channel."; 47 "Frame options are only available in dev channel.";
Matt Giuca 2014/05/07 11:48:34 Shouldn't this be going away?
benwells 2014/05/08 02:43:18 Done.
48 const char kColorWithFrameNone[] = "Windows with no frame cannot have a color."; 48 const char kColorWithFrameNone[] = "Windows with no frame cannot have a color.";
49 const char kInactiveColorWithoutColor[] = 49 const char kInactiveColorWithoutColor[] =
50 "frame.inactiveColor must be used with frame.color."; 50 "frame.inactiveColor must be used with frame.color.";
51 const char kConflictingBoundsOptions[] = 51 const char kConflictingBoundsOptions[] =
52 "The $1 property cannot be specified for both inner and outer bounds."; 52 "The $1 property cannot be specified for both inner and outer bounds.";
53 } // namespace app_window_constants 53 } // namespace app_window_constants
54 54
55 const char kNoneFrameOption[] = "none"; 55 const char kNoneFrameOption[] = "none";
56 // TODO(benwells): Remove HTML titlebar injection. 56 // TODO(benwells): Remove HTML titlebar injection.
57 const char kHtmlFrameOption[] = "experimental-html"; 57 const char kHtmlFrameOption[] = "experimental-html";
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 case extensions::api::app_window::STATE_MAXIMIZED: 254 case extensions::api::app_window::STATE_MAXIMIZED:
255 create_params.state = ui::SHOW_STATE_MAXIMIZED; 255 create_params.state = ui::SHOW_STATE_MAXIMIZED;
256 break; 256 break;
257 case extensions::api::app_window::STATE_MINIMIZED: 257 case extensions::api::app_window::STATE_MINIMIZED:
258 create_params.state = ui::SHOW_STATE_MINIMIZED; 258 create_params.state = ui::SHOW_STATE_MINIMIZED;
259 break; 259 break;
260 } 260 }
261 } 261 }
262 } 262 }
263 263
264 UpdateFrameOptionsForChannel(&create_params);
265
266 create_params.creator_process_id = 264 create_params.creator_process_id =
267 render_view_host_->GetProcess()->GetID(); 265 render_view_host_->GetProcess()->GetID();
268 266
269 AppWindow* app_window = apps::AppsClient::Get()->CreateAppWindow( 267 AppWindow* app_window = apps::AppsClient::Get()->CreateAppWindow(
270 browser_context(), GetExtension()); 268 browser_context(), GetExtension());
271 app_window->Init( 269 app_window->Init(
272 url, new apps::AppWindowContentsImpl(app_window), create_params); 270 url, new apps::AppWindowContentsImpl(app_window), create_params);
273 271
274 if (ExtensionsBrowserClient::Get()->IsRunningInForcedAppMode()) 272 if (ExtensionsBrowserClient::Get()->IsRunningInForcedAppMode())
275 app_window->ForcedFullscreen(); 273 app_window->ForcedFullscreen();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 AppWindow::CreateParams* create_params) { 429 AppWindow::CreateParams* create_params) {
432 if (!options.frame) 430 if (!options.frame)
433 return true; 431 return true;
434 432
435 DCHECK(options.frame->as_string || options.frame->as_frame_options); 433 DCHECK(options.frame->as_string || options.frame->as_frame_options);
436 if (options.frame->as_string) { 434 if (options.frame->as_string) {
437 create_params->frame = GetFrameFromString(*options.frame->as_string); 435 create_params->frame = GetFrameFromString(*options.frame->as_string);
438 return true; 436 return true;
439 } 437 }
440 438
441 if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) { 439 if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) {
Matt Giuca 2014/05/07 11:48:34 And this?
benwells 2014/05/08 02:43:18 Indeed it should. Gone.
442 error_ = app_window_constants::kInvalidChannelForFrameOptions; 440 error_ = app_window_constants::kInvalidChannelForFrameOptions;
443 return false; 441 return false;
444 } 442 }
445 443
446 if (options.frame->as_frame_options->type) 444 if (options.frame->as_frame_options->type)
447 create_params->frame = 445 create_params->frame =
448 GetFrameFromString(*options.frame->as_frame_options->type); 446 GetFrameFromString(*options.frame->as_frame_options->type);
449 447
450 if (options.frame->as_frame_options->color.get()) { 448 if (options.frame->as_frame_options->color.get()) {
451 if (create_params->frame != AppWindow::FRAME_CHROME) { 449 if (create_params->frame != AppWindow::FRAME_CHROME) {
(...skipping 24 matching lines...) Expand all
476 } 474 }
477 475
478 if (options.frame->as_frame_options->inactive_color.get()) { 476 if (options.frame->as_frame_options->inactive_color.get()) {
479 error_ = app_window_constants::kInactiveColorWithoutColor; 477 error_ = app_window_constants::kInactiveColorWithoutColor;
480 return false; 478 return false;
481 } 479 }
482 480
483 return true; 481 return true;
484 } 482 }
485 483
486 void AppWindowCreateFunction::UpdateFrameOptionsForChannel(
487 apps::AppWindow::CreateParams* create_params) {
488 #if defined(OS_WIN)
489 if (create_params->frame == AppWindow::FRAME_CHROME &&
490 GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) {
491 // If not on trunk or dev channel, always use the standard white frame.
492 // TODO(benwells): Remove this code once we get agreement to use the new
493 // native style frame.
494 create_params->has_frame_color = true;
495 create_params->active_frame_color = SK_ColorWHITE;
496 create_params->inactive_frame_color = SK_ColorWHITE;
497 }
498 #endif
499 }
500
501 } // namespace extensions 484 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698