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

Side by Side Diff: apps/app_window.cc

Issue 375183002: Add app.window.alphaEnabled() and onAlphaEnabledChanged. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 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 | Annotate | Revision Log
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 "apps/app_window.h" 5 #include "apps/app_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "apps/app_window_geometry_cache.h" 9 #include "apps/app_window_geometry_cache.h"
10 #include "apps/app_window_registry.h" 10 #include "apps/app_window_registry.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // Initialize the window 277 // Initialize the window
278 CreateParams new_params = LoadDefaults(params); 278 CreateParams new_params = LoadDefaults(params);
279 window_type_ = new_params.window_type; 279 window_type_ = new_params.window_type;
280 window_key_ = new_params.window_key; 280 window_key_ = new_params.window_key;
281 281
282 // Windows cannot be always-on-top in fullscreen mode for security reasons. 282 // Windows cannot be always-on-top in fullscreen mode for security reasons.
283 cached_always_on_top_ = new_params.always_on_top; 283 cached_always_on_top_ = new_params.always_on_top;
284 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) 284 if (new_params.state == ui::SHOW_STATE_FULLSCREEN)
285 new_params.always_on_top = false; 285 new_params.always_on_top = false;
286 286
287 requested_transparent_background_ = new_params.transparent_background;
288
287 native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params)); 289 native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params));
288 290
289 // Prevent the browser process from shutting down while this window exists. 291 // Prevent the browser process from shutting down while this window exists.
290 AppsClient::Get()->IncrementKeepAliveCount(); 292 AppsClient::Get()->IncrementKeepAliveCount();
291 UpdateExtensionAppIcon(); 293 UpdateExtensionAppIcon();
292 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); 294 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this);
293 295
294 if (new_params.hidden) { 296 if (new_params.hidden) {
295 // Although the window starts hidden by default, calling Hide() here 297 // Although the window starts hidden by default, calling Hide() here
296 // notifies observers of the window being hidden. 298 // notifies observers of the window being hidden.
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 OnNativeWindowChanged(); 737 OnNativeWindowChanged();
736 } 738 }
737 739
738 bool AppWindow::IsAlwaysOnTop() const { return cached_always_on_top_; } 740 bool AppWindow::IsAlwaysOnTop() const { return cached_always_on_top_; }
739 741
740 void AppWindow::WindowEventsReady() { 742 void AppWindow::WindowEventsReady() {
741 can_send_events_ = true; 743 can_send_events_ = true;
742 SendOnWindowShownIfShown(); 744 SendOnWindowShownIfShown();
743 } 745 }
744 746
747 bool AppWindow::RequestedTransparentBackground() const {
748 return requested_transparent_background_;
749 }
750
745 void AppWindow::GetSerializedState(base::DictionaryValue* properties) const { 751 void AppWindow::GetSerializedState(base::DictionaryValue* properties) const {
746 DCHECK(properties); 752 DCHECK(properties);
747 753
748 properties->SetBoolean("fullscreen", 754 properties->SetBoolean("fullscreen",
749 native_app_window_->IsFullscreenOrPending()); 755 native_app_window_->IsFullscreenOrPending());
750 properties->SetBoolean("minimized", native_app_window_->IsMinimized()); 756 properties->SetBoolean("minimized", native_app_window_->IsMinimized());
751 properties->SetBoolean("maximized", native_app_window_->IsMaximized()); 757 properties->SetBoolean("maximized", native_app_window_->IsMaximized());
752 properties->SetBoolean("alwaysOnTop", IsAlwaysOnTop()); 758 properties->SetBoolean("alwaysOnTop", IsAlwaysOnTop());
753 properties->SetBoolean("hasFrameColor", native_app_window_->HasFrameColor()); 759 properties->SetBoolean("hasFrameColor", native_app_window_->HasFrameColor());
760 properties->SetBoolean("alphaEnabled",
761 requested_transparent_background_
762 ? native_app_window_->CanHaveAlphaEnabled()
763 : false);
Wez 2014/07/11 17:14:10 nit: Or simply |requested_transparent_background_
jackhou1 2014/07/14 03:05:24 Done.
754 764
755 // These properties are undocumented and are to enable testing. Alpha is 765 // These properties are undocumented and are to enable testing. Alpha is
756 // removed to 766 // removed to
757 // make the values easier to check. 767 // make the values easier to check.
758 SkColor transparent_white = ~SK_ColorBLACK; 768 SkColor transparent_white = ~SK_ColorBLACK;
759 properties->SetInteger( 769 properties->SetInteger(
760 "activeFrameColor", 770 "activeFrameColor",
761 native_app_window_->ActiveFrameColor() & transparent_white); 771 native_app_window_->ActiveFrameColor() & transparent_white);
762 properties->SetInteger( 772 properties->SetInteger(
763 "inactiveFrameColor", 773 "inactiveFrameColor",
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 region.bounds.x(), 1152 region.bounds.x(),
1143 region.bounds.y(), 1153 region.bounds.y(),
1144 region.bounds.right(), 1154 region.bounds.right(),
1145 region.bounds.bottom(), 1155 region.bounds.bottom(),
1146 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); 1156 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
1147 } 1157 }
1148 return sk_region; 1158 return sk_region;
1149 } 1159 }
1150 1160
1151 } // namespace apps 1161 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698