| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 // AppWindow::CreateParams | 154 // AppWindow::CreateParams |
| 155 | 155 |
| 156 AppWindow::CreateParams::CreateParams() | 156 AppWindow::CreateParams::CreateParams() |
| 157 : window_type(AppWindow::WINDOW_TYPE_DEFAULT), | 157 : window_type(AppWindow::WINDOW_TYPE_DEFAULT), |
| 158 frame(AppWindow::FRAME_CHROME), | 158 frame(AppWindow::FRAME_CHROME), |
| 159 has_frame_color(false), | 159 has_frame_color(false), |
| 160 active_frame_color(SK_ColorBLACK), | 160 active_frame_color(SK_ColorBLACK), |
| 161 inactive_frame_color(SK_ColorBLACK), | 161 inactive_frame_color(SK_ColorBLACK), |
| 162 transparent_background(false), | 162 transparent_background(false), |
| 163 creator_process_id(0), | |
| 164 state(ui::SHOW_STATE_DEFAULT), | 163 state(ui::SHOW_STATE_DEFAULT), |
| 165 hidden(false), | 164 hidden(false), |
| 166 resizable(true), | 165 resizable(true), |
| 167 focused(true), | 166 focused(true), |
| 168 always_on_top(false) {} | 167 always_on_top(false) {} |
| 169 | 168 |
| 170 AppWindow::CreateParams::~CreateParams() {} | 169 AppWindow::CreateParams::~CreateParams() {} |
| 171 | 170 |
| 172 gfx::Rect AppWindow::CreateParams::GetInitialWindowBounds( | 171 gfx::Rect AppWindow::CreateParams::GetInitialWindowBounds( |
| 173 const gfx::Insets& frame_insets) const { | 172 const gfx::Insets& frame_insets) const { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // Close when the browser process is exiting. | 322 // Close when the browser process is exiting. |
| 324 registrar_.Add(this, | 323 registrar_.Add(this, |
| 325 chrome::NOTIFICATION_APP_TERMINATING, | 324 chrome::NOTIFICATION_APP_TERMINATING, |
| 326 content::NotificationService::AllSources()); | 325 content::NotificationService::AllSources()); |
| 327 // Update the app menu if an ephemeral app becomes installed. | 326 // Update the app menu if an ephemeral app becomes installed. |
| 328 registrar_.Add(this, | 327 registrar_.Add(this, |
| 329 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, | 328 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, |
| 330 content::Source<content::BrowserContext>( | 329 content::Source<content::BrowserContext>( |
| 331 client->GetOriginalContext(browser_context_))); | 330 client->GetOriginalContext(browser_context_))); |
| 332 | 331 |
| 333 app_window_contents_->LoadContents(new_params.creator_process_id); | 332 app_window_contents_->LoadContents(); |
| 334 | 333 |
| 335 if (CommandLine::ForCurrentProcess()->HasSwitch( | 334 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 336 switches::kEnableAppsShowOnFirstPaint)) { | 335 switches::kEnableAppsShowOnFirstPaint)) { |
| 337 // We want to show the window only when the content has been painted. For | 336 // We want to show the window only when the content has been painted. For |
| 338 // that to happen, we need to define a size for the content, otherwise the | 337 // that to happen, we need to define a size for the content, otherwise the |
| 339 // layout will happen in a 0x0 area. | 338 // layout will happen in a 0x0 area. |
| 340 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); | 339 gfx::Insets frame_insets = native_app_window_->GetFrameInsets(); |
| 341 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); | 340 gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets); |
| 342 initial_bounds.Inset(frame_insets); | 341 initial_bounds.Inset(frame_insets); |
| 343 apps::ResizeWebContents(web_contents, initial_bounds.size()); | 342 apps::ResizeWebContents(web_contents, initial_bounds.size()); |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 region.bounds.x(), | 1141 region.bounds.x(), |
| 1143 region.bounds.y(), | 1142 region.bounds.y(), |
| 1144 region.bounds.right(), | 1143 region.bounds.right(), |
| 1145 region.bounds.bottom(), | 1144 region.bounds.bottom(), |
| 1146 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1145 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 1147 } | 1146 } |
| 1148 return sk_region; | 1147 return sk_region; |
| 1149 } | 1148 } |
| 1150 | 1149 |
| 1151 } // namespace apps | 1150 } // namespace apps |
| OLD | NEW |