Chromium Code Reviews| 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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1202 NotificationDetails det = NotificationService::NoDetails(); | 1202 NotificationDetails det = NotificationService::NoDetails(); |
| 1203 if (details) | 1203 if (details) |
| 1204 det = Details<LoadNotificationDetails>(details); | 1204 det = Details<LoadNotificationDetails>(details); |
| 1205 NotificationService::current()->Notify(type, | 1205 NotificationService::current()->Notify(type, |
| 1206 Source<NavigationController>(&controller_), | 1206 Source<NavigationController>(&controller_), |
| 1207 det); | 1207 det); |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 void TabContents::ExpireInfoBars( | 1210 void TabContents::ExpireInfoBars( |
| 1211 const NavigationController::LoadCommittedDetails& details) { | 1211 const NavigationController::LoadCommittedDetails& details) { |
| 1212 // Only hide InfoBars when the user has done something that makes the main | 1212 bool non_user_initiated_load = !details.is_user_initiated_main_frame_load(); |
| 1213 // frame load. We don't want various automatic or subframe navigations making | |
| 1214 // it disappear. | |
| 1215 if (!details.is_user_initiated_main_frame_load()) | |
| 1216 return; | |
| 1217 | 1213 |
| 1218 // NOTE: It is not safe to change the following code to count upwards or use | 1214 // NOTE: It is not safe to change the following code to count upwards or use |
| 1219 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate | 1215 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate |
| 1220 // list. | 1216 // list. |
| 1221 for (size_t i = infobar_count(); i > 0; --i) { | 1217 for (size_t i = infobar_count(); i > 0; --i) { |
| 1222 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i - 1); | 1218 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i - 1); |
| 1219 if (non_user_initiated_load && | |
|
MAD
2011/05/13 12:41:56
I think the coding style asks for {} when the cond
| |
| 1220 delegate->DoNotCloseOnProgrammaticNavigation()) | |
|
brettw
2011/05/13 17:04:45
It's not clear why we need this extra function. Ca
| |
| 1221 continue; | |
|
MAD
2011/05/13 12:41:56
Too much indent, should be brought back two spaces
| |
| 1222 | |
| 1223 if (delegate->ShouldExpire(details)) | 1223 if (delegate->ShouldExpire(details)) |
| 1224 RemoveInfoBar(delegate); | 1224 RemoveInfoBar(delegate); |
| 1225 } | 1225 } |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 WebUI* TabContents::GetWebUIForCurrentState() { | 1228 WebUI* TabContents::GetWebUIForCurrentState() { |
| 1229 // When there is a pending navigation entry, we want to use the pending WebUI | 1229 // When there is a pending navigation entry, we want to use the pending WebUI |
| 1230 // that goes along with it to control the basic flags. For example, we want to | 1230 // that goes along with it to control the basic flags. For example, we want to |
| 1231 // show the pending URL in the URL bar, so we want the display_url flag to | 1231 // show the pending URL in the URL bar, so we want the display_url flag to |
| 1232 // be from the pending entry. | 1232 // be from the pending entry. |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2241 | 2241 |
| 2242 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2242 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2243 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2243 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2244 rwh_view->SetSize(view()->GetContainerSize()); | 2244 rwh_view->SetSize(view()->GetContainerSize()); |
| 2245 } | 2245 } |
| 2246 | 2246 |
| 2247 void TabContents::OnOnlineStateChanged(bool online) { | 2247 void TabContents::OnOnlineStateChanged(bool online) { |
| 2248 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2248 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 2249 render_view_host()->routing_id(), online)); | 2249 render_view_host()->routing_id(), online)); |
| 2250 } | 2250 } |
| OLD | NEW |