| 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/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView(); | 76 RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView(); |
| 77 // 70% opaque grey. | 77 // 70% opaque grey. |
| 78 SkColor greyish = SkColorSetARGB(178, 0, 0, 0); | 78 SkColor greyish = SkColorSetARGB(178, 0, 0, 0); |
| 79 if (rwhv) | 79 if (rwhv) |
| 80 rwhv->SetVisuallyDeemphasized(blocked ? &greyish : NULL, false); | 80 rwhv->SetVisuallyDeemphasized(blocked ? &greyish : NULL, false); |
| 81 // RenderViewHost may be NULL during shutdown. | 81 // RenderViewHost may be NULL during shutdown. |
| 82 if (contents->render_view_host()) | 82 if (contents->render_view_host()) |
| 83 contents->render_view_host()->set_ignore_input_events(blocked); | 83 contents->render_view_host()->set_ignore_input_events(blocked); |
| 84 if (delegate_) | 84 if (delegate_) |
| 85 delegate_->SetTabContentBlocked(wrapper_, blocked); | 85 delegate_->SetTabContentBlocked(wrapper_, blocked); |
| 86 |
| 87 if (!contents->is_being_destroyed() && contents->delegate()) { |
| 88 // Force the printing state to update. |
| 89 contents->SetContentRestrictions(contents->content_restrictions()); |
| 90 } |
| 86 } | 91 } |
| 87 | 92 |
| 88 void ConstrainedWindowTabHelper::DidNavigateMainFramePostCommit( | 93 void ConstrainedWindowTabHelper::DidNavigateMainFramePostCommit( |
| 89 const content::LoadCommittedDetails& details, | 94 const content::LoadCommittedDetails& details, |
| 90 const ViewHostMsg_FrameNavigate_Params& params) { | 95 const ViewHostMsg_FrameNavigate_Params& params) { |
| 91 // Close constrained windows if necessary. | 96 // Close constrained windows if necessary. |
| 92 if (!net::RegistryControlledDomainService::SameDomainOrHost( | 97 if (!net::RegistryControlledDomainService::SameDomainOrHost( |
| 93 details.previous_url, details.entry->url())) | 98 details.previous_url, details.entry->url())) |
| 94 CloseConstrainedWindows(); | 99 CloseConstrainedWindows(); |
| 95 } | 100 } |
| 96 | 101 |
| 97 void ConstrainedWindowTabHelper::DidGetIgnoredUIEvent() { | 102 void ConstrainedWindowTabHelper::DidGetIgnoredUIEvent() { |
| 98 if (constrained_window_count()) { | 103 if (constrained_window_count()) { |
| 99 ConstrainedWindow* window = *constrained_window_begin(); | 104 ConstrainedWindow* window = *constrained_window_begin(); |
| 100 window->FocusConstrainedWindow(); | 105 window->FocusConstrainedWindow(); |
| 101 } | 106 } |
| 102 } | 107 } |
| 103 | 108 |
| 104 void ConstrainedWindowTabHelper::TabContentsDestroyed(TabContents* tab) { | 109 void ConstrainedWindowTabHelper::TabContentsDestroyed(TabContents* tab) { |
| 105 // First cleanly close all child windows. | 110 // First cleanly close all child windows. |
| 106 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked | 111 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked |
| 107 // some of these to close. CloseWindows is async, so it might get called | 112 // some of these to close. CloseWindows is async, so it might get called |
| 108 // twice before it runs. | 113 // twice before it runs. |
| 109 CloseConstrainedWindows(); | 114 CloseConstrainedWindows(); |
| 110 } | 115 } |
| OLD | NEW |