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 22 matching lines...) Expand all Loading... |
33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
34 #include "content/public/browser/web_contents_view.h" | 34 #include "content/public/browser/web_contents_view.h" |
35 #include "content/public/common/media_stream_request.h" | 35 #include "content/public/common/media_stream_request.h" |
36 #include "extensions/browser/extension_system.h" | 36 #include "extensions/browser/extension_system.h" |
37 #include "extensions/browser/extensions_browser_client.h" | 37 #include "extensions/browser/extensions_browser_client.h" |
38 #include "extensions/browser/process_manager.h" | 38 #include "extensions/browser/process_manager.h" |
39 #include "extensions/browser/view_type_utils.h" | 39 #include "extensions/browser/view_type_utils.h" |
40 #include "extensions/common/extension.h" | 40 #include "extensions/common/extension.h" |
41 #include "extensions/common/extension_messages.h" | 41 #include "extensions/common/extension_messages.h" |
42 #include "third_party/skia/include/core/SkRegion.h" | 42 #include "third_party/skia/include/core/SkRegion.h" |
| 43 #include "ui/gfx/layout_util.h" |
43 #include "ui/gfx/screen.h" | 44 #include "ui/gfx/screen.h" |
44 | 45 |
45 #if !defined(OS_MACOSX) | 46 #if !defined(OS_MACOSX) |
46 #include "apps/pref_names.h" | 47 #include "apps/pref_names.h" |
47 #include "base/prefs/pref_service.h" | 48 #include "base/prefs/pref_service.h" |
48 #endif | 49 #endif |
49 | 50 |
50 using content::BrowserContext; | 51 using content::BrowserContext; |
51 using content::ConsoleMessageLevel; | 52 using content::ConsoleMessageLevel; |
52 using content::WebContents; | 53 using content::WebContents; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 317 |
317 if (CommandLine::ForCurrentProcess()->HasSwitch( | 318 if (CommandLine::ForCurrentProcess()->HasSwitch( |
318 switches::kEnableAppsShowOnFirstPaint)) { | 319 switches::kEnableAppsShowOnFirstPaint)) { |
319 // We want to show the window only when the content has been painted. For | 320 // We want to show the window only when the content has been painted. For |
320 // that to happen, we need to define a size for the content, otherwise the | 321 // that to happen, we need to define a size for the content, otherwise the |
321 // layout will happen in a 0x0 area. | 322 // layout will happen in a 0x0 area. |
322 // Note: WebContents::GetView() is guaranteed to be non-null. | 323 // Note: WebContents::GetView() is guaranteed to be non-null. |
323 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); | 324 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); |
324 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); | 325 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); |
325 initial_bounds.Inset(frame_insets); | 326 initial_bounds.Inset(frame_insets); |
326 web_contents->GetView()->SizeContents(initial_bounds.size()); | 327 gfx::ResizeWebContents(web_contents, initial_bounds.size()); |
327 } | 328 } |
328 | 329 |
329 // Prevent the browser process from shutting down while this window is open. | 330 // Prevent the browser process from shutting down while this window is open. |
330 AppsClient::Get()->IncrementKeepAliveCount(); | 331 AppsClient::Get()->IncrementKeepAliveCount(); |
331 | 332 |
332 UpdateExtensionAppIcon(); | 333 UpdateExtensionAppIcon(); |
333 | 334 |
334 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); | 335 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); |
335 } | 336 } |
336 | 337 |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 region.bounds.x(), | 1070 region.bounds.x(), |
1070 region.bounds.y(), | 1071 region.bounds.y(), |
1071 region.bounds.right(), | 1072 region.bounds.right(), |
1072 region.bounds.bottom(), | 1073 region.bounds.bottom(), |
1073 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1074 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1074 } | 1075 } |
1075 return sk_region; | 1076 return sk_region; |
1076 } | 1077 } |
1077 | 1078 |
1078 } // namespace apps | 1079 } // namespace apps |
OLD | NEW |