 Chromium Code Reviews
 Chromium Code Reviews Issue 138843006:
  Close crashed incognito-mode app's shell window.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 138843006:
  Close crashed incognito-mode app's shell window.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 else if (new_params.state == ui::SHOW_STATE_MINIMIZED) | 201 else if (new_params.state == ui::SHOW_STATE_MINIMIZED) | 
| 202 Minimize(); | 202 Minimize(); | 
| 203 | 203 | 
| 204 OnNativeWindowChanged(); | 204 OnNativeWindowChanged(); | 
| 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::NotificationService::AllSources()); | 
| 
Yoyo Zhou
2014/01/30 08:54:25
Use profile_->GetOriginalProfile instead. Then you
 
kinaba
2014/01/30 10:43:21
Good point. Thanks. Done.
 | |
| 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 | 215 | 
| 216 shell_window_contents_->LoadContents(new_params.creator_process_id); | 216 shell_window_contents_->LoadContents(new_params.creator_process_id); | 
| 217 | 217 | 
| 218 if (CommandLine::ForCurrentProcess()->HasSwitch( | 218 if (CommandLine::ForCurrentProcess()->HasSwitch( | 
| 219 switches::kEnableAppsShowOnFirstPaint)) { | 219 switches::kEnableAppsShowOnFirstPaint)) { | 
| 220 // We want to show the window only when the content has been painted. For | 220 // 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 | 221 // that to happen, we need to define a size for the content, otherwise the | 
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 } | 736 } | 
| 737 | 737 | 
| 738 void ShellWindow::Observe(int type, | 738 void ShellWindow::Observe(int type, | 
| 739 const content::NotificationSource& source, | 739 const content::NotificationSource& source, | 
| 740 const content::NotificationDetails& details) { | 740 const content::NotificationDetails& details) { | 
| 741 switch (type) { | 741 switch (type) { | 
| 742 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 742 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 
| 743 const extensions::Extension* unloaded_extension = | 743 const extensions::Extension* unloaded_extension = | 
| 744 content::Details<extensions::UnloadedExtensionInfo>( | 744 content::Details<extensions::UnloadedExtensionInfo>( | 
| 745 details)->extension; | 745 details)->extension; | 
| 746 if (extension_ == unloaded_extension) | 746 Profile* profile = content::Source<Profile>(source).ptr(); | 
| 747 if (profile_->IsSameProfile(profile) && extension_ == unloaded_extension) | |
| 747 native_app_window_->Close(); | 748 native_app_window_->Close(); | 
| 748 break; | 749 break; | 
| 749 } | 750 } | 
| 750 case chrome::NOTIFICATION_APP_TERMINATING: | 751 case chrome::NOTIFICATION_APP_TERMINATING: | 
| 751 native_app_window_->Close(); | 752 native_app_window_->Close(); | 
| 752 break; | 753 break; | 
| 753 default: | 754 default: | 
| 754 NOTREACHED() << "Received unexpected notification"; | 755 NOTREACHED() << "Received unexpected notification"; | 
| 755 } | 756 } | 
| 756 } | 757 } | 
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 region.bounds.x(), | 886 region.bounds.x(), | 
| 886 region.bounds.y(), | 887 region.bounds.y(), | 
| 887 region.bounds.right(), | 888 region.bounds.right(), | 
| 888 region.bounds.bottom(), | 889 region.bounds.bottom(), | 
| 889 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 890 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 
| 890 } | 891 } | 
| 891 return sk_region; | 892 return sk_region; | 
| 892 } | 893 } | 
| 893 | 894 | 
| 894 } // namespace apps | 895 } // namespace apps | 
| OLD | NEW |