Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: chrome/browser/ui/browser_commands.cc

Issue 207553008: Surface button for loading stale cache copy on net error page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor tweaks from self-review. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/browser_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/bookmarks/bookmark_model.h" 12 #include "chrome/browser/bookmarks/bookmark_model.h"
13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
14 #include "chrome/browser/bookmarks/bookmark_utils.h" 14 #include "chrome/browser/bookmarks/bookmark_utils.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/browsing_data/browsing_data_helper.h" 16 #include "chrome/browser/browsing_data/browsing_data_helper.h"
17 #include "chrome/browser/browsing_data/browsing_data_remover.h" 17 #include "chrome/browser/browsing_data/browsing_data_remover.h"
18 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/chrome_page_zoom.h" 19 #include "chrome/browser/chrome_page_zoom.h"
20 #include "chrome/browser/devtools/devtools_window.h" 20 #include "chrome/browser/devtools/devtools_window.h"
21 #include "chrome/browser/extensions/api/commands/command_service.h" 21 #include "chrome/browser/extensions/api/commands/command_service.h"
22 #include "chrome/browser/extensions/extension_service.h" 22 #include "chrome/browser/extensions/extension_service.h"
23 #include "chrome/browser/extensions/tab_helper.h" 23 #include "chrome/browser/extensions/tab_helper.h"
24 #include "chrome/browser/favicon/favicon_tab_helper.h" 24 #include "chrome/browser/favicon/favicon_tab_helper.h"
25 #include "chrome/browser/google/google_util.h" 25 #include "chrome/browser/google/google_util.h"
26 #include "chrome/browser/lifetime/application_lifetime.h" 26 #include "chrome/browser/lifetime/application_lifetime.h"
27 #include "chrome/browser/net/net_error_tab_helper.h"
27 #include "chrome/browser/platform_util.h" 28 #include "chrome/browser/platform_util.h"
28 #include "chrome/browser/prefs/incognito_mode_prefs.h" 29 #include "chrome/browser/prefs/incognito_mode_prefs.h"
29 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/rlz/rlz.h" 31 #include "chrome/browser/rlz/rlz.h"
31 #include "chrome/browser/search/search.h" 32 #include "chrome/browser/search/search.h"
32 #include "chrome/browser/sessions/session_service_factory.h" 33 #include "chrome/browser/sessions/session_service_factory.h"
33 #include "chrome/browser/sessions/tab_restore_service.h" 34 #include "chrome/browser/sessions/tab_restore_service.h"
34 #include "chrome/browser/sessions/tab_restore_service_delegate.h" 35 #include "chrome/browser/sessions/tab_restore_service_delegate.h"
35 #include "chrome/browser/sessions/tab_restore_service_factory.h" 36 #include "chrome/browser/sessions/tab_restore_service_factory.h"
36 #include "chrome/browser/translate/translate_tab_helper.h" 37 #include "chrome/browser/translate/translate_tab_helper.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 WindowOpenDisposition disposition, 234 WindowOpenDisposition disposition,
234 bool ignore_cache) { 235 bool ignore_cache) {
235 // As this is caused by a user action, give the focus to the page. 236 // As this is caused by a user action, give the focus to the page.
236 // 237 //
237 // Also notify RenderViewHostDelegate of the user gesture; this is 238 // Also notify RenderViewHostDelegate of the user gesture; this is
238 // normally done in Browser::Navigate, but a reload bypasses Navigate. 239 // normally done in Browser::Navigate, but a reload bypasses Navigate.
239 WebContents* new_tab = GetTabAndRevertIfNecessary(browser, disposition); 240 WebContents* new_tab = GetTabAndRevertIfNecessary(browser, disposition);
240 new_tab->UserGestureDone(); 241 new_tab->UserGestureDone();
241 if (!new_tab->FocusLocationBarByDefault()) 242 if (!new_tab->FocusLocationBarByDefault())
242 new_tab->GetView()->Focus(); 243 new_tab->GetView()->Focus();
244
245 // Notify error system for statistics.
246 chrome_browser_net::NetErrorTabHelper* net_error_tab_helper =
247 chrome_browser_net::NetErrorTabHelper::FromWebContents(new_tab);
248 if (net_error_tab_helper)
249 net_error_tab_helper->NotifyBrowserReloading();
mmenke 2014/04/09 15:59:26 We can't deduce this from the information passed t
Randy Smith (Not in Mondays) 2014/04/10 21:51:01 So I stopped here going down the stack because thi
250
243 if (ignore_cache) 251 if (ignore_cache)
244 new_tab->GetController().ReloadIgnoringCache(true); 252 new_tab->GetController().ReloadIgnoringCache(true);
245 else 253 else
246 new_tab->GetController().Reload(true); 254 new_tab->GetController().Reload(true);
247 } 255 }
248 256
249 bool IsShowingWebContentsModalDialog(const Browser* browser) { 257 bool IsShowingWebContentsModalDialog(const Browser* browser) {
250 WebContents* web_contents = 258 WebContents* web_contents =
251 browser->tab_strip_model()->GetActiveWebContents(); 259 browser->tab_strip_model()->GetActiveWebContents();
252 if (!web_contents) 260 if (!web_contents)
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), 1271 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(),
1264 browser->host_desktop_type())); 1272 browser->host_desktop_type()));
1265 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1273 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1266 1274
1267 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1275 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1268 contents->GetRenderViewHost()->SyncRendererPrefs(); 1276 contents->GetRenderViewHost()->SyncRendererPrefs();
1269 app_browser->window()->Show(); 1277 app_browser->window()->Show();
1270 } 1278 }
1271 1279
1272 } // namespace chrome 1280 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698