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 "extensions/browser/app_window/app_window.h" | 5 #include "extensions/browser/app_window/app_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 // AppWindow::CreateParams | 149 // AppWindow::CreateParams |
150 | 150 |
151 AppWindow::CreateParams::CreateParams() | 151 AppWindow::CreateParams::CreateParams() |
152 : window_type(AppWindow::WINDOW_TYPE_DEFAULT), | 152 : window_type(AppWindow::WINDOW_TYPE_DEFAULT), |
153 frame(AppWindow::FRAME_CHROME), | 153 frame(AppWindow::FRAME_CHROME), |
154 has_frame_color(false), | 154 has_frame_color(false), |
155 active_frame_color(SK_ColorBLACK), | 155 active_frame_color(SK_ColorBLACK), |
156 inactive_frame_color(SK_ColorBLACK), | 156 inactive_frame_color(SK_ColorBLACK), |
157 alpha_enabled(false), | 157 alpha_enabled(false), |
| 158 is_ime_window(false), |
158 creator_process_id(0), | 159 creator_process_id(0), |
159 state(ui::SHOW_STATE_DEFAULT), | 160 state(ui::SHOW_STATE_DEFAULT), |
160 hidden(false), | 161 hidden(false), |
161 resizable(true), | 162 resizable(true), |
162 focused(true), | 163 focused(true), |
163 always_on_top(false) { | 164 always_on_top(false) { |
164 } | 165 } |
165 | 166 |
166 AppWindow::CreateParams::~CreateParams() {} | 167 AppWindow::CreateParams::~CreateParams() {} |
167 | 168 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 window_type_(WINDOW_TYPE_DEFAULT), | 232 window_type_(WINDOW_TYPE_DEFAULT), |
232 app_delegate_(app_delegate), | 233 app_delegate_(app_delegate), |
233 image_loader_ptr_factory_(this), | 234 image_loader_ptr_factory_(this), |
234 fullscreen_types_(FULLSCREEN_TYPE_NONE), | 235 fullscreen_types_(FULLSCREEN_TYPE_NONE), |
235 show_on_first_paint_(false), | 236 show_on_first_paint_(false), |
236 first_paint_complete_(false), | 237 first_paint_complete_(false), |
237 has_been_shown_(false), | 238 has_been_shown_(false), |
238 can_send_events_(false), | 239 can_send_events_(false), |
239 is_hidden_(false), | 240 is_hidden_(false), |
240 cached_always_on_top_(false), | 241 cached_always_on_top_(false), |
241 requested_alpha_enabled_(false) { | 242 requested_alpha_enabled_(false), |
| 243 is_ime_window_(false) { |
242 ExtensionsBrowserClient* client = ExtensionsBrowserClient::Get(); | 244 ExtensionsBrowserClient* client = ExtensionsBrowserClient::Get(); |
243 CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord()) | 245 CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord()) |
244 << "Only off the record window may be opened in the guest mode."; | 246 << "Only off the record window may be opened in the guest mode."; |
245 } | 247 } |
246 | 248 |
247 void AppWindow::Init(const GURL& url, | 249 void AppWindow::Init(const GURL& url, |
248 AppWindowContents* app_window_contents, | 250 AppWindowContents* app_window_contents, |
249 const CreateParams& params) { | 251 const CreateParams& params) { |
250 // Initialize the render interface and web contents | 252 // Initialize the render interface and web contents |
251 app_window_contents_.reset(app_window_contents); | 253 app_window_contents_.reset(app_window_contents); |
(...skipping 16 matching lines...) Expand all Loading... |
268 CreateParams new_params = LoadDefaults(params); | 270 CreateParams new_params = LoadDefaults(params); |
269 window_type_ = new_params.window_type; | 271 window_type_ = new_params.window_type; |
270 window_key_ = new_params.window_key; | 272 window_key_ = new_params.window_key; |
271 | 273 |
272 // Windows cannot be always-on-top in fullscreen mode for security reasons. | 274 // Windows cannot be always-on-top in fullscreen mode for security reasons. |
273 cached_always_on_top_ = new_params.always_on_top; | 275 cached_always_on_top_ = new_params.always_on_top; |
274 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) | 276 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) |
275 new_params.always_on_top = false; | 277 new_params.always_on_top = false; |
276 | 278 |
277 requested_alpha_enabled_ = new_params.alpha_enabled; | 279 requested_alpha_enabled_ = new_params.alpha_enabled; |
| 280 is_ime_window_ = new_params.is_ime_window; |
278 | 281 |
279 AppsClient* apps_client = AppsClient::Get(); | 282 AppsClient* apps_client = AppsClient::Get(); |
280 native_app_window_.reset( | 283 native_app_window_.reset( |
281 apps_client->CreateNativeAppWindow(this, new_params)); | 284 apps_client->CreateNativeAppWindow(this, new_params)); |
282 | 285 |
283 helper_.reset(new AppWebContentsHelper( | 286 helper_.reset(new AppWebContentsHelper( |
284 browser_context_, extension_id_, web_contents, app_delegate_.get())); | 287 browser_context_, extension_id_, web_contents, app_delegate_.get())); |
285 | 288 |
286 popup_manager_.reset( | 289 popup_manager_.reset( |
287 new web_modal::PopupManager(GetWebContentsModalDialogHost())); | 290 new web_modal::PopupManager(GetWebContentsModalDialogHost())); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 720 |
718 properties->SetBoolean("fullscreen", | 721 properties->SetBoolean("fullscreen", |
719 native_app_window_->IsFullscreenOrPending()); | 722 native_app_window_->IsFullscreenOrPending()); |
720 properties->SetBoolean("minimized", native_app_window_->IsMinimized()); | 723 properties->SetBoolean("minimized", native_app_window_->IsMinimized()); |
721 properties->SetBoolean("maximized", native_app_window_->IsMaximized()); | 724 properties->SetBoolean("maximized", native_app_window_->IsMaximized()); |
722 properties->SetBoolean("alwaysOnTop", IsAlwaysOnTop()); | 725 properties->SetBoolean("alwaysOnTop", IsAlwaysOnTop()); |
723 properties->SetBoolean("hasFrameColor", native_app_window_->HasFrameColor()); | 726 properties->SetBoolean("hasFrameColor", native_app_window_->HasFrameColor()); |
724 properties->SetBoolean( | 727 properties->SetBoolean( |
725 "alphaEnabled", | 728 "alphaEnabled", |
726 requested_alpha_enabled_ && native_app_window_->CanHaveAlphaEnabled()); | 729 requested_alpha_enabled_ && native_app_window_->CanHaveAlphaEnabled()); |
| 730 properties->SetBoolean("isImeWindow", is_ime_window_); |
727 | 731 |
728 // These properties are undocumented and are to enable testing. Alpha is | 732 // These properties are undocumented and are to enable testing. Alpha is |
729 // removed to | 733 // removed to |
730 // make the values easier to check. | 734 // make the values easier to check. |
731 SkColor transparent_white = ~SK_ColorBLACK; | 735 SkColor transparent_white = ~SK_ColorBLACK; |
732 properties->SetInteger( | 736 properties->SetInteger( |
733 "activeFrameColor", | 737 "activeFrameColor", |
734 native_app_window_->ActiveFrameColor() & transparent_white); | 738 native_app_window_->ActiveFrameColor() & transparent_white); |
735 properties->SetInteger( | 739 properties->SetInteger( |
736 "inactiveFrameColor", | 740 "inactiveFrameColor", |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 region.bounds.x(), | 1085 region.bounds.x(), |
1082 region.bounds.y(), | 1086 region.bounds.y(), |
1083 region.bounds.right(), | 1087 region.bounds.right(), |
1084 region.bounds.bottom(), | 1088 region.bounds.bottom(), |
1085 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1089 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1086 } | 1090 } |
1087 return sk_region; | 1091 return sk_region; |
1088 } | 1092 } |
1089 | 1093 |
1090 } // namespace extensions | 1094 } // namespace extensions |
OLD | NEW |