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 "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 NotificationDetails det = NotificationService::NoDetails(); | 1200 NotificationDetails det = NotificationService::NoDetails(); |
1201 if (details) | 1201 if (details) |
1202 det = Details<LoadNotificationDetails>(details); | 1202 det = Details<LoadNotificationDetails>(details); |
1203 NotificationService::current()->Notify(type, | 1203 NotificationService::current()->Notify(type, |
1204 Source<NavigationController>(&controller_), | 1204 Source<NavigationController>(&controller_), |
1205 det); | 1205 det); |
1206 } | 1206 } |
1207 | 1207 |
1208 void TabContents::ExpireInfoBars( | 1208 void TabContents::ExpireInfoBars( |
1209 const NavigationController::LoadCommittedDetails& details) { | 1209 const NavigationController::LoadCommittedDetails& details) { |
1210 // Only hide InfoBars when the user has done something that makes the main | |
1211 // frame load. We don't want various automatic or subframe navigations making | |
1212 // it disappear. | |
1213 if (!details.is_user_initiated_main_frame_load()) | |
1214 return; | |
1215 | |
1216 // NOTE: It is not safe to change the following code to count upwards or use | 1210 // NOTE: It is not safe to change the following code to count upwards or use |
1217 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate | 1211 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate |
1218 // list. | 1212 // list. |
1219 for (size_t i = infobar_count(); i > 0; --i) { | 1213 for (size_t i = infobar_count(); i > 0; --i) { |
1220 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i - 1); | 1214 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i - 1); |
1221 if (delegate->ShouldExpire(details)) | 1215 if (delegate->ShouldExpire(details)) |
1222 RemoveInfoBar(delegate); | 1216 RemoveInfoBar(delegate); |
1223 } | 1217 } |
1224 } | 1218 } |
1225 | 1219 |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 | 2213 |
2220 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2214 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2221 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2215 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2222 rwh_view->SetSize(view()->GetContainerSize()); | 2216 rwh_view->SetSize(view()->GetContainerSize()); |
2223 } | 2217 } |
2224 | 2218 |
2225 void TabContents::OnOnlineStateChanged(bool online) { | 2219 void TabContents::OnOnlineStateChanged(bool online) { |
2226 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2220 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
2227 render_view_host()->routing_id(), online)); | 2221 render_view_host()->routing_id(), online)); |
2228 } | 2222 } |
OLD | NEW |