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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 registrar_.Add(this, | 313 registrar_.Add(this, |
314 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 314 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
315 content::Source<content::BrowserContext>( | 315 content::Source<content::BrowserContext>( |
316 client->GetOriginalContext(browser_context_))); | 316 client->GetOriginalContext(browser_context_))); |
317 // Close when the browser process is exiting. | 317 // Close when the browser process is exiting. |
318 registrar_.Add(this, | 318 registrar_.Add(this, |
319 chrome::NOTIFICATION_APP_TERMINATING, | 319 chrome::NOTIFICATION_APP_TERMINATING, |
320 content::NotificationService::AllSources()); | 320 content::NotificationService::AllSources()); |
321 // Update the app menu if an ephemeral app becomes installed. | 321 // Update the app menu if an ephemeral app becomes installed. |
322 registrar_.Add(this, | 322 registrar_.Add(this, |
323 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 323 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, |
324 content::Source<content::BrowserContext>( | 324 content::Source<content::BrowserContext>( |
325 client->GetOriginalContext(browser_context_))); | 325 client->GetOriginalContext(browser_context_))); |
326 | 326 |
327 app_window_contents_->LoadContents(new_params.creator_process_id); | 327 app_window_contents_->LoadContents(new_params.creator_process_id); |
328 | 328 |
329 if (CommandLine::ForCurrentProcess()->HasSwitch( | 329 if (CommandLine::ForCurrentProcess()->HasSwitch( |
330 switches::kEnableAppsShowOnFirstPaint)) { | 330 switches::kEnableAppsShowOnFirstPaint)) { |
331 // We want to show the window only when the content has been painted. For | 331 // We want to show the window only when the content has been painted. For |
332 // that to happen, we need to define a size for the content, otherwise the | 332 // that to happen, we need to define a size for the content, otherwise the |
333 // layout will happen in a 0x0 area. | 333 // layout will happen in a 0x0 area. |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 const content::NotificationDetails& details) { | 964 const content::NotificationDetails& details) { |
965 switch (type) { | 965 switch (type) { |
966 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { | 966 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
967 const extensions::Extension* unloaded_extension = | 967 const extensions::Extension* unloaded_extension = |
968 content::Details<extensions::UnloadedExtensionInfo>(details) | 968 content::Details<extensions::UnloadedExtensionInfo>(details) |
969 ->extension; | 969 ->extension; |
970 if (extension_id_ == unloaded_extension->id()) | 970 if (extension_id_ == unloaded_extension->id()) |
971 native_app_window_->Close(); | 971 native_app_window_->Close(); |
972 break; | 972 break; |
973 } | 973 } |
974 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { | 974 case chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED: { |
975 const extensions::Extension* installed_extension = | 975 const extensions::Extension* installed_extension = |
976 content::Details<const extensions::InstalledExtensionInfo>(details) | 976 content::Details<const extensions::InstalledExtensionInfo>(details) |
977 ->extension; | 977 ->extension; |
978 DCHECK(installed_extension); | 978 DCHECK(installed_extension); |
979 if (installed_extension->id() == extension_id()) | 979 if (installed_extension->id() == extension_id()) |
980 native_app_window_->UpdateShelfMenu(); | 980 native_app_window_->UpdateShelfMenu(); |
981 break; | 981 break; |
982 } | 982 } |
983 case chrome::NOTIFICATION_APP_TERMINATING: | 983 case chrome::NOTIFICATION_APP_TERMINATING: |
984 native_app_window_->Close(); | 984 native_app_window_->Close(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 region.bounds.x(), | 1119 region.bounds.x(), |
1120 region.bounds.y(), | 1120 region.bounds.y(), |
1121 region.bounds.right(), | 1121 region.bounds.right(), |
1122 region.bounds.bottom(), | 1122 region.bounds.bottom(), |
1123 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1123 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1124 } | 1124 } |
1125 return sk_region; | 1125 return sk_region; |
1126 } | 1126 } |
1127 | 1127 |
1128 } // namespace apps | 1128 } // namespace apps |
OLD | NEW |