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/native_app_window.h" | 7 #include "apps/native_app_window.h" |
8 #include "apps/shell_window_geometry_cache.h" | 8 #include "apps/shell_window_geometry_cache.h" |
9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 Maximize(); | 176 Maximize(); |
177 else if (new_params.state == ui::SHOW_STATE_MINIMIZED) | 177 else if (new_params.state == ui::SHOW_STATE_MINIMIZED) |
178 Minimize(); | 178 Minimize(); |
179 | 179 |
180 OnNativeWindowChanged(); | 180 OnNativeWindowChanged(); |
181 | 181 |
182 // When the render view host is changed, the native window needs to know | 182 // When the render view host is changed, the native window needs to know |
183 // about it in case it has any setup to do to make the renderer appear | 183 // about it in case it has any setup to do to make the renderer appear |
184 // properly. In particular, on Windows, the view's clickthrough region needs | 184 // properly. In particular, on Windows, the view's clickthrough region needs |
185 // to be set. | 185 // to be set. |
186 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, | |
187 content::Source<content::NavigationController>( | |
188 &web_contents->GetController())); | |
189 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 186 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
190 content::Source<Profile>(profile_)); | 187 content::Source<Profile>(profile_)); |
191 // Close when the browser process is exiting. | 188 // Close when the browser process is exiting. |
192 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 189 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
193 content::NotificationService::AllSources()); | 190 content::NotificationService::AllSources()); |
194 | 191 |
195 shell_window_contents_->LoadContents(params.creator_process_id); | 192 shell_window_contents_->LoadContents(params.creator_process_id); |
196 | 193 |
197 // Prevent the browser process from shutting down while this window is open. | 194 // Prevent the browser process from shutting down while this window is open. |
198 chrome::StartKeepAlive(); | 195 chrome::StartKeepAlive(); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 533 |
537 bool ShellWindow::IsFullscreenForTabOrPending( | 534 bool ShellWindow::IsFullscreenForTabOrPending( |
538 const content::WebContents* source) const { | 535 const content::WebContents* source) const { |
539 return fullscreen_for_tab_; | 536 return fullscreen_for_tab_; |
540 } | 537 } |
541 | 538 |
542 void ShellWindow::Observe(int type, | 539 void ShellWindow::Observe(int type, |
543 const content::NotificationSource& source, | 540 const content::NotificationSource& source, |
544 const content::NotificationDetails& details) { | 541 const content::NotificationDetails& details) { |
545 switch (type) { | 542 switch (type) { |
546 case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED: { | |
547 // TODO(jianli): once http://crbug.com/123007 is fixed, we'll no longer | |
548 // need to make the native window (ShellWindowViews specially) update | |
549 // the clickthrough region for the new RVH. | |
550 native_app_window_->RenderViewHostChanged(); | |
551 break; | |
552 } | |
553 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 543 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
554 const extensions::Extension* unloaded_extension = | 544 const extensions::Extension* unloaded_extension = |
555 content::Details<extensions::UnloadedExtensionInfo>( | 545 content::Details<extensions::UnloadedExtensionInfo>( |
556 details)->extension; | 546 details)->extension; |
557 if (extension_ == unloaded_extension) | 547 if (extension_ == unloaded_extension) |
558 native_app_window_->Close(); | 548 native_app_window_->Close(); |
559 break; | 549 break; |
560 } | 550 } |
561 case chrome::NOTIFICATION_APP_TERMINATING: | 551 case chrome::NOTIFICATION_APP_TERMINATING: |
562 native_app_window_->Close(); | 552 native_app_window_->Close(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 region.bounds.x(), | 644 region.bounds.x(), |
655 region.bounds.y(), | 645 region.bounds.y(), |
656 region.bounds.right(), | 646 region.bounds.right(), |
657 region.bounds.bottom(), | 647 region.bounds.bottom(), |
658 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 648 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
659 } | 649 } |
660 return sk_region; | 650 return sk_region; |
661 } | 651 } |
662 | 652 |
663 } // namespace apps | 653 } // namespace apps |
OLD | NEW |