| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell_window.h" | 5 #include "apps/shell_window.h" |
| 6 | 6 |
| 7 #include "apps/shell_window_geometry_cache.h" | 7 #include "apps/shell_window_geometry_cache.h" |
| 8 #include "apps/shell_window_registry.h" | 8 #include "apps/shell_window_registry.h" |
| 9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 // When the render view host is changed, the native window needs to know | 206 // When the render view host is changed, the native window needs to know |
| 207 // about it in case it has any setup to do to make the renderer appear | 207 // about it in case it has any setup to do to make the renderer appear |
| 208 // properly. In particular, on Windows, the view's clickthrough region needs | 208 // properly. In particular, on Windows, the view's clickthrough region needs |
| 209 // to be set. | 209 // to be set. |
| 210 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 210 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 211 content::Source<Profile>(profile_)); | 211 content::Source<Profile>(profile_)); |
| 212 // Close when the browser process is exiting. | 212 // Close when the browser process is exiting. |
| 213 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 213 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
| 214 content::NotificationService::AllSources()); | 214 content::NotificationService::AllSources()); |
| 215 // Update the app menu if an ephemeral app becomes installed. |
| 216 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 217 content::Source<Profile>(profile_)); |
| 215 | 218 |
| 216 shell_window_contents_->LoadContents(new_params.creator_process_id); | 219 shell_window_contents_->LoadContents(new_params.creator_process_id); |
| 217 | 220 |
| 218 if (CommandLine::ForCurrentProcess()->HasSwitch( | 221 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 219 switches::kEnableAppsShowOnFirstPaint)) { | 222 switches::kEnableAppsShowOnFirstPaint)) { |
| 220 // We want to show the window only when the content has been painted. For | 223 // We want to show the window only when the content has been painted. For |
| 221 // that to happen, we need to define a size for the content, otherwise the | 224 // that to happen, we need to define a size for the content, otherwise the |
| 222 // layout will happen in a 0x0 area. | 225 // layout will happen in a 0x0 area. |
| 223 // Note: WebContents::GetView() is guaranteed to be non-null. | 226 // Note: WebContents::GetView() is guaranteed to be non-null. |
| 224 web_contents->GetView()->SizeContents(new_params.bounds.size()); | 227 web_contents->GetView()->SizeContents(new_params.bounds.size()); |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 const content::NotificationDetails& details) { | 743 const content::NotificationDetails& details) { |
| 741 switch (type) { | 744 switch (type) { |
| 742 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 745 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
| 743 const extensions::Extension* unloaded_extension = | 746 const extensions::Extension* unloaded_extension = |
| 744 content::Details<extensions::UnloadedExtensionInfo>( | 747 content::Details<extensions::UnloadedExtensionInfo>( |
| 745 details)->extension; | 748 details)->extension; |
| 746 if (extension_ == unloaded_extension) | 749 if (extension_ == unloaded_extension) |
| 747 native_app_window_->Close(); | 750 native_app_window_->Close(); |
| 748 break; | 751 break; |
| 749 } | 752 } |
| 753 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { |
| 754 const extensions::Extension* installed_extension = |
| 755 content::Details<const extensions::InstalledExtensionInfo>( |
| 756 details)->extension; |
| 757 DCHECK(installed_extension); |
| 758 if (installed_extension->id() == extension_->id()) |
| 759 native_app_window_->UpdateAppMenu(); |
| 760 break; |
| 761 } |
| 750 case chrome::NOTIFICATION_APP_TERMINATING: | 762 case chrome::NOTIFICATION_APP_TERMINATING: |
| 751 native_app_window_->Close(); | 763 native_app_window_->Close(); |
| 752 break; | 764 break; |
| 753 default: | 765 default: |
| 754 NOTREACHED() << "Received unexpected notification"; | 766 NOTREACHED() << "Received unexpected notification"; |
| 755 } | 767 } |
| 756 } | 768 } |
| 757 | 769 |
| 758 void ShellWindow::SetWebContentsBlocked(content::WebContents* web_contents, | 770 void ShellWindow::SetWebContentsBlocked(content::WebContents* web_contents, |
| 759 bool blocked) { | 771 bool blocked) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 region.bounds.x(), | 897 region.bounds.x(), |
| 886 region.bounds.y(), | 898 region.bounds.y(), |
| 887 region.bounds.right(), | 899 region.bounds.right(), |
| 888 region.bounds.bottom(), | 900 region.bounds.bottom(), |
| 889 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 901 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 890 } | 902 } |
| 891 return sk_region; | 903 return sk_region; |
| 892 } | 904 } |
| 893 | 905 |
| 894 } // namespace apps | 906 } // namespace apps |
| OLD | NEW |