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 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 NotificationDetails det = NotificationService::NoDetails(); | 1285 NotificationDetails det = NotificationService::NoDetails(); |
1286 if (details) | 1286 if (details) |
1287 det = Details<LoadNotificationDetails>(details); | 1287 det = Details<LoadNotificationDetails>(details); |
1288 NotificationService::current()->Notify(type, | 1288 NotificationService::current()->Notify(type, |
1289 Source<NavigationController>(&controller_), | 1289 Source<NavigationController>(&controller_), |
1290 det); | 1290 det); |
1291 } | 1291 } |
1292 | 1292 |
1293 void TabContents::ExpireInfoBars( | 1293 void TabContents::ExpireInfoBars( |
1294 const NavigationController::LoadCommittedDetails& details) { | 1294 const NavigationController::LoadCommittedDetails& details) { |
1295 // Only hide InfoBars when the user has done something that makes the main | |
1296 // frame load. We don't want various automatic or subframe navigations making | |
1297 // it disappear. | |
1298 if (!details.is_user_initiated_main_frame_load()) | |
1299 return; | |
1300 | |
1301 // NOTE: It is not safe to change the following code to count upwards or use | 1295 // NOTE: It is not safe to change the following code to count upwards or use |
1302 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate | 1296 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate |
1303 // list. | 1297 // list. |
1304 for (size_t i = infobar_count(); i > 0; --i) { | 1298 for (size_t i = infobar_count(); i > 0; --i) { |
1305 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i - 1); | 1299 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i - 1); |
1306 if (delegate->ShouldExpire(details)) | 1300 if (delegate->ShouldExpire(details)) |
1307 RemoveInfoBar(delegate); | 1301 RemoveInfoBar(delegate); |
1308 } | 1302 } |
1309 } | 1303 } |
1310 | 1304 |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 | 2340 |
2347 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2341 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2348 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2342 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2349 rwh_view->SetSize(view()->GetContainerSize()); | 2343 rwh_view->SetSize(view()->GetContainerSize()); |
2350 } | 2344 } |
2351 | 2345 |
2352 void TabContents::OnOnlineStateChanged(bool online) { | 2346 void TabContents::OnOnlineStateChanged(bool online) { |
2353 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2347 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
2354 render_view_host()->routing_id(), online)); | 2348 render_view_host()->routing_id(), online)); |
2355 } | 2349 } |
OLD | NEW |