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 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "apps/app_window_registry.h" | 11 #include "apps/app_window_registry.h" |
12 #include "apps/ui/apps_client.h" | 12 #include "apps/ui/apps_client.h" |
13 #include "apps/ui/web_contents_sizer.h" | |
14 #include "base/command_line.h" | 13 #include "base/command_line.h" |
15 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
17 #include "base/values.h" | 16 #include "base/values.h" |
18 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 17 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
19 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
20 #include "content/public/browser/invalidate_type.h" | 19 #include "content/public/browser/invalidate_type.h" |
21 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
22 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
23 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 app_window_contents_->LoadContents(new_params.creator_process_id); | 339 app_window_contents_->LoadContents(new_params.creator_process_id); |
341 | 340 |
342 if (CommandLine::ForCurrentProcess()->HasSwitch( | 341 if (CommandLine::ForCurrentProcess()->HasSwitch( |
343 extensions::switches::kEnableAppsShowOnFirstPaint)) { | 342 extensions::switches::kEnableAppsShowOnFirstPaint)) { |
344 // We want to show the window only when the content has been painted. For | 343 // We want to show the window only when the content has been painted. For |
345 // that to happen, we need to define a size for the content, otherwise the | 344 // that to happen, we need to define a size for the content, otherwise the |
346 // layout will happen in a 0x0 area. | 345 // layout will happen in a 0x0 area. |
347 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); | 346 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); |
348 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); | 347 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); |
349 initial_bounds.Inset(frame_insets); | 348 initial_bounds.Inset(frame_insets); |
350 apps::ResizeWebContents(web_contents, initial_bounds.size()); | 349 app_delegate_->ResizeWebContents(web_contents, initial_bounds.size()); |
351 } | 350 } |
352 } | 351 } |
353 | 352 |
354 AppWindow::~AppWindow() { | 353 AppWindow::~AppWindow() { |
355 // Unregister now to prevent getting notified if we're the last window open. | 354 // Unregister now to prevent getting notified if we're the last window open. |
356 app_delegate_->SetTerminatingCallback(base::Closure()); | 355 app_delegate_->SetTerminatingCallback(base::Closure()); |
357 | 356 |
358 // Remove shutdown prevention. | 357 // Remove shutdown prevention. |
359 AppsClient::Get()->DecrementKeepAliveCount(); | 358 AppsClient::Get()->DecrementKeepAliveCount(); |
360 } | 359 } |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 region.bounds.x(), | 1090 region.bounds.x(), |
1092 region.bounds.y(), | 1091 region.bounds.y(), |
1093 region.bounds.right(), | 1092 region.bounds.right(), |
1094 region.bounds.bottom(), | 1093 region.bounds.bottom(), |
1095 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1094 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1096 } | 1095 } |
1097 return sk_region; | 1096 return sk_region; |
1098 } | 1097 } |
1099 | 1098 |
1100 } // namespace apps | 1099 } // namespace apps |
OLD | NEW |