| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/constrained_window_tab_helper.h" | 5 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/constrained_window.h" | 7 #include "chrome/browser/ui/constrained_window.h" |
| 8 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" | 8 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" |
| 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 if (child_windows_.empty()) { | 63 if (child_windows_.empty()) { |
| 64 BlockTabContent(false); | 64 BlockTabContent(false); |
| 65 } else { | 65 } else { |
| 66 if (removed_topmost_window) | 66 if (removed_topmost_window) |
| 67 child_windows_[0]->ShowConstrainedWindow(); | 67 child_windows_[0]->ShowConstrainedWindow(); |
| 68 BlockTabContent(true); | 68 BlockTabContent(true); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ConstrainedWindowTabHelper::BlockTabContent(bool blocked) { | 72 void ConstrainedWindowTabHelper::BlockTabContent(bool blocked) { |
| 73 TabContents* contents = tab_contents(); | 73 WebContents* contents = web_contents(); |
| 74 if (!contents) { | 74 if (!contents) { |
| 75 // The TabContents has already disconnected. | 75 // The TabContents has already disconnected. |
| 76 return; | 76 return; |
| 77 } | 77 } |
| 78 | 78 |
| 79 // RenderViewHost may be NULL during shutdown. | 79 // RenderViewHost may be NULL during shutdown. |
| 80 RenderViewHost* host = contents->GetRenderViewHost(); | 80 RenderViewHost* host = contents->GetRenderViewHost(); |
| 81 if (host) { | 81 if (host) { |
| 82 host->set_ignore_input_events(blocked); | 82 host->set_ignore_input_events(blocked); |
| 83 host->Send( | 83 host->Send( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) { | 106 void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) { |
| 107 // First cleanly close all child windows. | 107 // First cleanly close all child windows. |
| 108 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked | 108 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked |
| 109 // some of these to close. CloseWindows is async, so it might get called | 109 // some of these to close. CloseWindows is async, so it might get called |
| 110 // twice before it runs. | 110 // twice before it runs. |
| 111 CloseConstrainedWindows(); | 111 CloseConstrainedWindows(); |
| 112 } | 112 } |
| OLD | NEW |