Chromium Code Reviews| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 window_type_(WINDOW_TYPE_DEFAULT), | 235 window_type_(WINDOW_TYPE_DEFAULT), |
| 236 app_delegate_(app_delegate), | 236 app_delegate_(app_delegate), |
| 237 image_loader_ptr_factory_(this), | 237 image_loader_ptr_factory_(this), |
| 238 fullscreen_types_(FULLSCREEN_TYPE_NONE), | 238 fullscreen_types_(FULLSCREEN_TYPE_NONE), |
| 239 show_on_first_paint_(false), | 239 show_on_first_paint_(false), |
| 240 first_paint_complete_(false), | 240 first_paint_complete_(false), |
| 241 has_been_shown_(false), | 241 has_been_shown_(false), |
| 242 can_send_events_(false), | 242 can_send_events_(false), |
| 243 is_hidden_(false), | 243 is_hidden_(false), |
| 244 cached_always_on_top_(false), | 244 cached_always_on_top_(false), |
| 245 requested_alpha_enabled_(false) { | 245 requested_alpha_enabled_(false), |
| 246 cached_want_all_keys_(false) { | |
| 246 ExtensionsBrowserClient* client = ExtensionsBrowserClient::Get(); | 247 ExtensionsBrowserClient* client = ExtensionsBrowserClient::Get(); |
| 247 CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord()) | 248 CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord()) |
| 248 << "Only off the record window may be opened in the guest mode."; | 249 << "Only off the record window may be opened in the guest mode."; |
| 249 } | 250 } |
| 250 | 251 |
| 251 void AppWindow::Init(const GURL& url, | 252 void AppWindow::Init(const GURL& url, |
| 252 AppWindowContents* app_window_contents, | 253 AppWindowContents* app_window_contents, |
| 253 const CreateParams& params) { | 254 const CreateParams& params) { |
| 254 // Initialize the render interface and web contents | 255 // Initialize the render interface and web contents |
| 255 app_window_contents_.reset(app_window_contents); | 256 app_window_contents_.reset(app_window_contents); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 // that to happen, we need to define a size for the content, otherwise the | 342 // that to happen, we need to define a size for the content, otherwise the |
| 342 // layout will happen in a 0x0 area. | 343 // layout will happen in a 0x0 area. |
| 343 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); | 344 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); |
| 344 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); | 345 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); |
| 345 initial_bounds.Inset(frame_insets); | 346 initial_bounds.Inset(frame_insets); |
| 346 app_delegate_->ResizeWebContents(web_contents, initial_bounds.size()); | 347 app_delegate_->ResizeWebContents(web_contents, initial_bounds.size()); |
| 347 } | 348 } |
| 348 } | 349 } |
| 349 | 350 |
| 350 AppWindow::~AppWindow() { | 351 AppWindow::~AppWindow() { |
| 352 if (cached_want_all_keys_) { | |
|
benwells
2014/11/21 00:52:01
Why is this necessary? Shouldn't the new WidgetObs
Sriram
2014/11/21 05:35:21
Done.
| |
| 353 native_app_window_->SetInterceptAllKeys(false); | |
| 354 cached_want_all_keys_ = false; | |
| 355 } | |
| 351 } | 356 } |
| 352 | 357 |
| 353 void AppWindow::RequestMediaAccessPermission( | 358 void AppWindow::RequestMediaAccessPermission( |
| 354 content::WebContents* web_contents, | 359 content::WebContents* web_contents, |
| 355 const content::MediaStreamRequest& request, | 360 const content::MediaStreamRequest& request, |
| 356 const content::MediaResponseCallback& callback) { | 361 const content::MediaResponseCallback& callback) { |
| 357 DCHECK_EQ(AppWindow::web_contents(), web_contents); | 362 DCHECK_EQ(AppWindow::web_contents(), web_contents); |
| 358 helper_->RequestMediaAccessPermission(request, callback); | 363 helper_->RequestMediaAccessPermission(request, callback); |
| 359 } | 364 } |
| 360 | 365 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 // overlap the taskbar to be on top. The property will be applied when the | 708 // overlap the taskbar to be on top. The property will be applied when the |
| 704 // window exits fullscreen and moves away from the taskbar. | 709 // window exits fullscreen and moves away from the taskbar. |
| 705 if (!IsFullscreen() && !IntersectsWithTaskbar()) | 710 if (!IsFullscreen() && !IntersectsWithTaskbar()) |
| 706 native_app_window_->SetAlwaysOnTop(always_on_top); | 711 native_app_window_->SetAlwaysOnTop(always_on_top); |
| 707 | 712 |
| 708 OnNativeWindowChanged(); | 713 OnNativeWindowChanged(); |
| 709 } | 714 } |
| 710 | 715 |
| 711 bool AppWindow::IsAlwaysOnTop() const { return cached_always_on_top_; } | 716 bool AppWindow::IsAlwaysOnTop() const { return cached_always_on_top_; } |
| 712 | 717 |
| 718 void AppWindow::SetInterceptAllKeys(bool want_all_keys) { | |
| 719 if (cached_want_all_keys_ != want_all_keys) { | |
| 720 native_app_window_->SetInterceptAllKeys(want_all_keys); | |
| 721 cached_want_all_keys_ = want_all_keys; | |
| 722 } | |
| 723 } | |
| 724 | |
| 713 void AppWindow::WindowEventsReady() { | 725 void AppWindow::WindowEventsReady() { |
| 714 can_send_events_ = true; | 726 can_send_events_ = true; |
| 715 SendOnWindowShownIfShown(); | 727 SendOnWindowShownIfShown(); |
| 716 } | 728 } |
| 717 | 729 |
| 718 void AppWindow::GetSerializedState(base::DictionaryValue* properties) const { | 730 void AppWindow::GetSerializedState(base::DictionaryValue* properties) const { |
| 719 DCHECK(properties); | 731 DCHECK(properties); |
| 720 | 732 |
| 721 properties->SetBoolean("fullscreen", | 733 properties->SetBoolean("fullscreen", |
| 722 native_app_window_->IsFullscreenOrPending()); | 734 native_app_window_->IsFullscreenOrPending()); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1088 region.bounds.x(), | 1100 region.bounds.x(), |
| 1089 region.bounds.y(), | 1101 region.bounds.y(), |
| 1090 region.bounds.right(), | 1102 region.bounds.right(), |
| 1091 region.bounds.bottom(), | 1103 region.bounds.bottom(), |
| 1092 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1104 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 1093 } | 1105 } |
| 1094 return sk_region; | 1106 return sk_region; |
| 1095 } | 1107 } |
| 1096 | 1108 |
| 1097 } // namespace extensions | 1109 } // namespace extensions |
| OLD | NEW |