| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 void ConstrainedWindowTabHelper::BlockTabContent(bool blocked) { | 73 void ConstrainedWindowTabHelper::BlockTabContent(bool blocked) { |
| 74 WebContents* contents = web_contents(); | 74 WebContents* contents = web_contents(); |
| 75 if (!contents) { | 75 if (!contents) { |
| 76 // The TabContents has already disconnected. | 76 // The TabContents has already disconnected. |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // RenderViewHost may be NULL during shutdown. | 80 // RenderViewHost may be NULL during shutdown. |
| 81 RenderViewHost* host = contents->GetRenderViewHost(); | 81 content::RenderViewHost* host = contents->GetRenderViewHost(); |
| 82 if (host) { | 82 if (host) { |
| 83 host->SetIgnoreInputEvents(blocked); | 83 host->SetIgnoreInputEvents(blocked); |
| 84 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized( | 84 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized( |
| 85 host->GetRoutingID(), blocked)); | 85 host->GetRoutingID(), blocked)); |
| 86 } | 86 } |
| 87 if (delegate_) | 87 if (delegate_) |
| 88 delegate_->SetTabContentBlocked(wrapper_, blocked); | 88 delegate_->SetTabContentBlocked(wrapper_, blocked); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void ConstrainedWindowTabHelper::DidNavigateMainFrame( | 91 void ConstrainedWindowTabHelper::DidNavigateMainFrame( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) { | 107 void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) { |
| 108 // First cleanly close all child windows. | 108 // First cleanly close all child windows. |
| 109 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked | 109 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked |
| 110 // some of these to close. CloseWindows is async, so it might get called | 110 // some of these to close. CloseWindows is async, so it might get called |
| 111 // twice before it runs. | 111 // twice before it runs. |
| 112 CloseConstrainedWindows(); | 112 CloseConstrainedWindows(); |
| 113 } | 113 } |
| OLD | NEW |