| OLD | NEW |
| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 extension_id_(extension->id()), | 238 extension_id_(extension->id()), |
| 239 window_type_(WINDOW_TYPE_DEFAULT), | 239 window_type_(WINDOW_TYPE_DEFAULT), |
| 240 delegate_(delegate), | 240 delegate_(delegate), |
| 241 image_loader_ptr_factory_(this), | 241 image_loader_ptr_factory_(this), |
| 242 fullscreen_types_(FULLSCREEN_TYPE_NONE), | 242 fullscreen_types_(FULLSCREEN_TYPE_NONE), |
| 243 show_on_first_paint_(false), | 243 show_on_first_paint_(false), |
| 244 first_paint_complete_(false), | 244 first_paint_complete_(false), |
| 245 has_been_shown_(false), | 245 has_been_shown_(false), |
| 246 can_send_events_(false), | 246 can_send_events_(false), |
| 247 is_hidden_(false), | 247 is_hidden_(false), |
| 248 cached_always_on_top_(false) { | 248 cached_always_on_top_(false), |
| 249 requested_transparent_background_(false) { |
| 249 extensions::ExtensionsBrowserClient* client = | 250 extensions::ExtensionsBrowserClient* client = |
| 250 extensions::ExtensionsBrowserClient::Get(); | 251 extensions::ExtensionsBrowserClient::Get(); |
| 251 CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord()) | 252 CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord()) |
| 252 << "Only off the record window may be opened in the guest mode."; | 253 << "Only off the record window may be opened in the guest mode."; |
| 253 } | 254 } |
| 254 | 255 |
| 255 void AppWindow::Init(const GURL& url, | 256 void AppWindow::Init(const GURL& url, |
| 256 AppWindowContents* app_window_contents, | 257 AppWindowContents* app_window_contents, |
| 257 const CreateParams& params) { | 258 const CreateParams& params) { |
| 258 // Initialize the render interface and web contents | 259 // Initialize the render interface and web contents |
| (...skipping 19 matching lines...) Expand all Loading... |
| 278 // Initialize the window | 279 // Initialize the window |
| 279 CreateParams new_params = LoadDefaults(params); | 280 CreateParams new_params = LoadDefaults(params); |
| 280 window_type_ = new_params.window_type; | 281 window_type_ = new_params.window_type; |
| 281 window_key_ = new_params.window_key; | 282 window_key_ = new_params.window_key; |
| 282 | 283 |
| 283 // Windows cannot be always-on-top in fullscreen mode for security reasons. | 284 // Windows cannot be always-on-top in fullscreen mode for security reasons. |
| 284 cached_always_on_top_ = new_params.always_on_top; | 285 cached_always_on_top_ = new_params.always_on_top; |
| 285 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) | 286 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) |
| 286 new_params.always_on_top = false; | 287 new_params.always_on_top = false; |
| 287 | 288 |
| 289 requested_transparent_background_ = new_params.transparent_background; |
| 290 |
| 288 native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params)); | 291 native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params)); |
| 289 | 292 |
| 290 popup_manager_.reset( | 293 popup_manager_.reset( |
| 291 new web_modal::PopupManager(GetWebContentsModalDialogHost())); | 294 new web_modal::PopupManager(GetWebContentsModalDialogHost())); |
| 292 popup_manager_->RegisterWith(web_contents); | 295 popup_manager_->RegisterWith(web_contents); |
| 293 | 296 |
| 294 // Prevent the browser process from shutting down while this window exists. | 297 // Prevent the browser process from shutting down while this window exists. |
| 295 AppsClient::Get()->IncrementKeepAliveCount(); | 298 AppsClient::Get()->IncrementKeepAliveCount(); |
| 296 UpdateExtensionAppIcon(); | 299 UpdateExtensionAppIcon(); |
| 297 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); | 300 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 752 |
| 750 void AppWindow::GetSerializedState(base::DictionaryValue* properties) const { | 753 void AppWindow::GetSerializedState(base::DictionaryValue* properties) const { |
| 751 DCHECK(properties); | 754 DCHECK(properties); |
| 752 | 755 |
| 753 properties->SetBoolean("fullscreen", | 756 properties->SetBoolean("fullscreen", |
| 754 native_app_window_->IsFullscreenOrPending()); | 757 native_app_window_->IsFullscreenOrPending()); |
| 755 properties->SetBoolean("minimized", native_app_window_->IsMinimized()); | 758 properties->SetBoolean("minimized", native_app_window_->IsMinimized()); |
| 756 properties->SetBoolean("maximized", native_app_window_->IsMaximized()); | 759 properties->SetBoolean("maximized", native_app_window_->IsMaximized()); |
| 757 properties->SetBoolean("alwaysOnTop", IsAlwaysOnTop()); | 760 properties->SetBoolean("alwaysOnTop", IsAlwaysOnTop()); |
| 758 properties->SetBoolean("hasFrameColor", native_app_window_->HasFrameColor()); | 761 properties->SetBoolean("hasFrameColor", native_app_window_->HasFrameColor()); |
| 762 properties->SetBoolean("alphaEnabled", |
| 763 requested_transparent_background_ && |
| 764 native_app_window_->CanHaveAlphaEnabled()); |
| 759 | 765 |
| 760 // These properties are undocumented and are to enable testing. Alpha is | 766 // These properties are undocumented and are to enable testing. Alpha is |
| 761 // removed to | 767 // removed to |
| 762 // make the values easier to check. | 768 // make the values easier to check. |
| 763 SkColor transparent_white = ~SK_ColorBLACK; | 769 SkColor transparent_white = ~SK_ColorBLACK; |
| 764 properties->SetInteger( | 770 properties->SetInteger( |
| 765 "activeFrameColor", | 771 "activeFrameColor", |
| 766 native_app_window_->ActiveFrameColor() & transparent_white); | 772 native_app_window_->ActiveFrameColor() & transparent_white); |
| 767 properties->SetInteger( | 773 properties->SetInteger( |
| 768 "inactiveFrameColor", | 774 "inactiveFrameColor", |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 region.bounds.x(), | 1153 region.bounds.x(), |
| 1148 region.bounds.y(), | 1154 region.bounds.y(), |
| 1149 region.bounds.right(), | 1155 region.bounds.right(), |
| 1150 region.bounds.bottom(), | 1156 region.bounds.bottom(), |
| 1151 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1157 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 1152 } | 1158 } |
| 1153 return sk_region; | 1159 return sk_region; |
| 1154 } | 1160 } |
| 1155 | 1161 |
| 1156 } // namespace apps | 1162 } // namespace apps |
| OLD | NEW |