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/views/tab_contents/tab_contents_view_views.h" | 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/browser_shutdown.h" |
10 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 11 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
12 #include "chrome/browser/ui/views/sad_tab_view.h" | 13 #include "chrome/browser/ui/views/sad_tab_view.h" |
13 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h" | 14 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h" |
14 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" | 15 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" |
15 #include "content/browser/renderer_host/render_process_host.h" | 16 #include "content/browser/renderer_host/render_process_host.h" |
16 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
17 #include "content/browser/renderer_host/render_view_host_factory.h" | 18 #include "content/browser/renderer_host/render_view_host_factory.h" |
18 #include "content/browser/renderer_host/render_widget_host_view.h" | 19 #include "content/browser/renderer_host/render_widget_host_view.h" |
19 #include "content/browser/tab_contents/interstitial_page.h" | 20 #include "content/browser/tab_contents/interstitial_page.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const gfx::Point& image_offset) { | 121 const gfx::Point& image_offset) { |
121 native_tab_contents_view_->StartDragging(drop_data, ops, image, image_offset); | 122 native_tab_contents_view_->StartDragging(drop_data, ops, image, image_offset); |
122 } | 123 } |
123 | 124 |
124 void TabContentsViewViews::SetPageTitle(const string16& title) { | 125 void TabContentsViewViews::SetPageTitle(const string16& title) { |
125 native_tab_contents_view_->SetPageTitle(title); | 126 native_tab_contents_view_->SetPageTitle(title); |
126 } | 127 } |
127 | 128 |
128 void TabContentsViewViews::OnTabCrashed(base::TerminationStatus status, | 129 void TabContentsViewViews::OnTabCrashed(base::TerminationStatus status, |
129 int /* error_code */) { | 130 int /* error_code */) { |
| 131 // Only show the sad tab if we're not in browser shutdown, so that TabContents |
| 132 // objects that are not in a browser (e.g., HTML dialogs) and thus are |
| 133 // visible do not flash a sad tab page. |
| 134 if (browser_shutdown::GetShutdownType() != browser_shutdown::NOT_VALID) |
| 135 return; |
| 136 |
130 // Force an invalidation to render sad tab. | 137 // Force an invalidation to render sad tab. |
131 // Note that it's possible to get this message after the window was destroyed. | 138 // Note that it's possible to get this message after the window was destroyed. |
132 if (GetNativeView()) { | 139 if (GetNativeView()) { |
133 SadTabView::Kind kind = | 140 SadTabView::Kind kind = |
134 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? | 141 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
135 SadTabView::KILLED : SadTabView::CRASHED; | 142 SadTabView::KILLED : SadTabView::CRASHED; |
136 sad_tab_ = new SadTabView(tab_contents_, kind); | 143 sad_tab_ = new SadTabView(tab_contents_, kind); |
137 SetContentsView(sad_tab_); | 144 SetContentsView(sad_tab_); |
138 sad_tab_->SchedulePaint(); | 145 sad_tab_->SchedulePaint(); |
139 } | 146 } |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } | 444 } |
438 | 445 |
439 void TabContentsViewViews::OnNativeWidgetVisibilityChanged(bool visible) { | 446 void TabContentsViewViews::OnNativeWidgetVisibilityChanged(bool visible) { |
440 views::Widget::OnNativeWidgetVisibilityChanged(visible); | 447 views::Widget::OnNativeWidgetVisibilityChanged(visible); |
441 if (visible) { | 448 if (visible) { |
442 tab_contents_->ShowContents(); | 449 tab_contents_->ShowContents(); |
443 } else { | 450 } else { |
444 tab_contents_->HideContents(); | 451 tab_contents_->HideContents(); |
445 } | 452 } |
446 } | 453 } |
OLD | NEW |