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

Side by Side Diff: chrome/renderer/net/net_error_helper.cc

Issue 326043002: Cleanup: Remove more dead GTK code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix accidental revert Created 6 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer/net/net_error_helper.h" 5 #include "chrome/renderer/net/net_error_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 return NetErrorHelperCore::NON_ERROR_PAGE; 61 return NetErrorHelperCore::NON_ERROR_PAGE;
62 return NetErrorHelperCore::ERROR_PAGE; 62 return NetErrorHelperCore::ERROR_PAGE;
63 } 63 }
64 64
65 NetErrorHelperCore::FrameType GetFrameType(const blink::WebFrame* frame) { 65 NetErrorHelperCore::FrameType GetFrameType(const blink::WebFrame* frame) {
66 if (!frame->parent()) 66 if (!frame->parent())
67 return NetErrorHelperCore::MAIN_FRAME; 67 return NetErrorHelperCore::MAIN_FRAME;
68 return NetErrorHelperCore::SUB_FRAME; 68 return NetErrorHelperCore::SUB_FRAME;
69 } 69 }
70 70
71 // Copied from localized_error.cc.
72 // TODO(mmenke): Share code?
73 bool LocaleIsRTL() {
74 #if defined(TOOLKIT_GTK)
75 // base::i18n::IsRTL() uses the GTK text direction, which doesn't work within
76 // the renderer sandbox.
77 return base::i18n::ICUIsRTL();
78 #else
79 return base::i18n::IsRTL();
80 #endif
81 }
82
83 } // namespace 71 } // namespace
84 72
85 NetErrorHelper::NetErrorHelper(RenderFrame* render_frame) 73 NetErrorHelper::NetErrorHelper(RenderFrame* render_frame)
86 : RenderFrameObserver(render_frame), 74 : RenderFrameObserver(render_frame),
87 content::RenderFrameObserverTracker<NetErrorHelper>(render_frame) { 75 content::RenderFrameObserverTracker<NetErrorHelper>(render_frame) {
88 RenderThread::Get()->AddObserver(this); 76 RenderThread::Get()->AddObserver(this);
89 CommandLine* command_line = CommandLine::ForCurrentProcess(); 77 CommandLine* command_line = CommandLine::ForCurrentProcess();
90 bool auto_reload_enabled = 78 bool auto_reload_enabled =
91 command_line->HasSwitch(switches::kEnableOfflineAutoReload); 79 command_line->HasSwitch(switches::kEnableOfflineAutoReload);
92 bool auto_reload_visible_only = 80 bool auto_reload_visible_only =
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 country_code, api_key, search_url); 323 country_code, api_key, search_url);
336 } 324 }
337 325
338 void NetErrorHelper::OnNavigationCorrectionsFetched( 326 void NetErrorHelper::OnNavigationCorrectionsFetched(
339 const blink::WebURLResponse& response, 327 const blink::WebURLResponse& response,
340 const std::string& data) { 328 const std::string& data) {
341 // The fetcher may only be deleted after |data| is passed to |core_|. Move 329 // The fetcher may only be deleted after |data| is passed to |core_|. Move
342 // it to a temporary to prevent any potential re-entrancy issues. 330 // it to a temporary to prevent any potential re-entrancy issues.
343 scoped_ptr<content::ResourceFetcher> fetcher( 331 scoped_ptr<content::ResourceFetcher> fetcher(
344 correction_fetcher_.release()); 332 correction_fetcher_.release());
345 if (!response.isNull() && response.httpStatusCode() == 200) { 333 bool success = (!response.isNull() && response.httpStatusCode() == 200);
346 core_->OnNavigationCorrectionsFetched( 334 core_->OnNavigationCorrectionsFetched(
347 data, render_frame()->GetRenderView()->GetAcceptLanguages(), 335 success ? data : "",
348 LocaleIsRTL()); 336 render_frame()->GetRenderView()->GetAcceptLanguages(),
349 } else { 337 base::i18n::IsRTL());
350 core_->OnNavigationCorrectionsFetched(
351 "", render_frame()->GetRenderView()->GetAcceptLanguages(),
352 LocaleIsRTL());
353 }
354 } 338 }
355 339
356 void NetErrorHelper::OnTrackingRequestComplete( 340 void NetErrorHelper::OnTrackingRequestComplete(
357 const blink::WebURLResponse& response, 341 const blink::WebURLResponse& response,
358 const std::string& data) { 342 const std::string& data) {
359 tracking_fetcher_.reset(); 343 tracking_fetcher_.reset();
360 } 344 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/obsolete_system_infobar_delegate.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698