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

Side by Side Diff: chrome/renderer/searchbox/searchbox.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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 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/renderer/searchbox/searchbox.h" 5 #include "chrome/renderer/searchbox/searchbox.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // slash), |*view_id| := "<view_id>", |*rid| := "rid", and returns true. 172 // slash), |*view_id| := "<view_id>", |*rid| := "rid", and returns true.
173 bool ParseIconRestrictedUrl(const GURL& url, 173 bool ParseIconRestrictedUrl(const GURL& url,
174 SearchBox::ImageSourceType type, 174 SearchBox::ImageSourceType type,
175 std::string* param_part, 175 std::string* param_part,
176 int* view_id, 176 int* view_id,
177 InstantRestrictedID* rid) { 177 InstantRestrictedID* rid) {
178 DCHECK(param_part); 178 DCHECK(param_part);
179 DCHECK(view_id); 179 DCHECK(view_id);
180 DCHECK(rid); 180 DCHECK(rid);
181 // Strip leading slash. 181 // Strip leading slash.
182 std::string raw_path = url.path(); 182 std::string raw_path = url.path().as_string();
183 DCHECK_GT(raw_path.length(), (size_t) 0); 183 DCHECK_GT(raw_path.length(), (size_t) 0);
184 DCHECK_EQ(raw_path[0], '/'); 184 DCHECK_EQ(raw_path[0], '/');
185 raw_path = raw_path.substr(1); 185 raw_path = raw_path.substr(1);
186 186
187 int path_index = GetImagePathStartOfPageURL(type, raw_path); 187 int path_index = GetImagePathStartOfPageURL(type, raw_path);
188 if (path_index < 0) 188 if (path_index < 0)
189 return false; 189 return false;
190 190
191 std::string id_part = raw_path.substr(path_index); 191 std::string id_part = raw_path.substr(path_index);
192 if (!ParseViewIdAndRestrictedId(id_part, view_id, rid)) 192 if (!ParseViewIdAndRestrictedId(id_part, view_id, rid))
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 embedded_search_request_params_ = EmbeddedSearchRequestParams(); 515 embedded_search_request_params_ = EmbeddedSearchRequestParams();
516 suggestion_ = InstantSuggestion(); 516 suggestion_ = InstantSuggestion();
517 is_focused_ = false; 517 is_focused_ = false;
518 is_key_capture_enabled_ = false; 518 is_key_capture_enabled_ = false;
519 theme_info_ = ThemeBackgroundInfo(); 519 theme_info_ = ThemeBackgroundInfo();
520 } 520 }
521 521
522 void SearchBox::OnDestruct() { 522 void SearchBox::OnDestruct() {
523 delete this; 523 delete this;
524 } 524 }
OLDNEW
« no previous file with comments | « chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc ('k') | chrome/test/chromedriver/net/websocket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698