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

Side by Side Diff: chrome/browser/ui/search/new_tab_page_interceptor_service.cc

Issue 2409423005: Compare GURLs to kUrlConstants with .spec() and string equality (Closed)
Patch Set: rebase on dependent patch Created 4 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/search/new_tab_page_interceptor_service.h" 5 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 net::NetworkDelegate* network_delegate) const override { 54 net::NetworkDelegate* network_delegate) const override {
55 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 55 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
56 return nullptr; 56 return nullptr;
57 } 57 }
58 58
59 net::URLRequestJob* MaybeInterceptResponse( 59 net::URLRequestJob* MaybeInterceptResponse(
60 net::URLRequest* request, 60 net::URLRequest* request,
61 net::NetworkDelegate* network_delegate) const override { 61 net::NetworkDelegate* network_delegate) const override {
62 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 62 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
63 if ((request->url() != new_tab_url_) || 63 if ((request->url() != new_tab_url_) ||
64 (new_tab_url_ == GURL(chrome::kChromeSearchLocalNtpUrl))) { 64 (new_tab_url_ == chrome::kChromeSearchLocalNtpUrl)) {
65 return nullptr; 65 return nullptr;
66 } 66 }
67 // User has canceled this navigation so it shouldn't be redirected. 67 // User has canceled this navigation so it shouldn't be redirected.
68 // TODO(maksims): Remove request->status() and use int net_error 68 // TODO(maksims): Remove request->status() and use int net_error
69 // once MaybeInterceptResponse() starts to pass that. 69 // once MaybeInterceptResponse() starts to pass that.
70 if (request->status().status() == net::URLRequestStatus::CANCELED || 70 if (request->status().status() == net::URLRequestStatus::CANCELED ||
71 (request->status().status() == net::URLRequestStatus::FAILED && 71 (request->status().status() == net::URLRequestStatus::FAILED &&
72 request->status().error() == net::ERR_ABORTED)) { 72 request->status().error() == net::ERR_ABORTED)) {
73 return nullptr; 73 return nullptr;
74 } 74 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 std::unique_ptr<net::URLRequestInterceptor> 123 std::unique_ptr<net::URLRequestInterceptor>
124 NewTabPageInterceptorService::CreateInterceptor() { 124 NewTabPageInterceptorService::CreateInterceptor() {
125 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 125 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
126 std::unique_ptr<NewTabPageInterceptor> interceptor( 126 std::unique_ptr<NewTabPageInterceptor> interceptor(
127 new NewTabPageInterceptor(search::GetNewTabPageURL(profile_))); 127 new NewTabPageInterceptor(search::GetNewTabPageURL(profile_)));
128 interceptor_ = interceptor->GetWeakPtr(); 128 interceptor_ = interceptor->GetWeakPtr();
129 return std::move(interceptor); 129 return std::move(interceptor);
130 } 130 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/chrome_sync_client.cc ('k') | chrome/browser/ui/search/search_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698