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

Side by Side Diff: url/gurl.cc

Issue 19857005: Do not show translate bar for MHTML files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add and use GURL::ExtractFileExtension() Created 7 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifdef WIN32 5 #ifdef WIN32
6 #include <windows.h> 6 #include <windows.h>
7 #else 7 #else
8 #include <pthread.h> 8 #include <pthread.h>
9 #endif 9 #endif
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 parsed_.scheme.len); 367 parsed_.scheme.len);
368 return int_port; 368 return int_port;
369 } 369 }
370 370
371 std::string GURL::ExtractFileName() const { 371 std::string GURL::ExtractFileName() const {
372 url_parse::Component file_component; 372 url_parse::Component file_component;
373 url_parse::ExtractFileName(spec_.data(), parsed_.path, &file_component); 373 url_parse::ExtractFileName(spec_.data(), parsed_.path, &file_component);
374 return ComponentString(file_component); 374 return ComponentString(file_component);
375 } 375 }
376 376
377 std::string GURL::ExtractFileExtension() const {
378 url_parse::Component file_extension_component;
379 url_parse::ExtractFileExtension(spec_.data(), parsed_.path,
380 &file_extension_component);
381 return ComponentString(file_extension_component);
382 }
383
377 std::string GURL::PathForRequest() const { 384 std::string GURL::PathForRequest() const {
378 DCHECK(parsed_.path.len > 0) << "Canonical path for requests should be non-emp ty"; 385 DCHECK(parsed_.path.len > 0) << "Canonical path for requests should be non-emp ty";
379 if (parsed_.ref.len >= 0) { 386 if (parsed_.ref.len >= 0) {
380 // Clip off the reference when it exists. The reference starts after the # 387 // Clip off the reference when it exists. The reference starts after the #
381 // sign, so we have to subtract one to also remove it. 388 // sign, so we have to subtract one to also remove it.
382 return std::string(spec_, parsed_.path.begin, 389 return std::string(spec_, parsed_.path.begin,
383 parsed_.ref.begin - parsed_.path.begin - 1); 390 parsed_.ref.begin - parsed_.path.begin - 1);
384 } 391 }
385 // Compute the actual path length, rather than depending on the spec's 392 // Compute the actual path length, rather than depending on the spec's
386 // terminator. If we're an inner_url, our spec continues on into our outer 393 // terminator. If we're an inner_url, our spec continues on into our outer
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 void GURL::Swap(GURL* other) { 502 void GURL::Swap(GURL* other) {
496 spec_.swap(other->spec_); 503 spec_.swap(other->spec_);
497 std::swap(is_valid_, other->is_valid_); 504 std::swap(is_valid_, other->is_valid_);
498 std::swap(parsed_, other->parsed_); 505 std::swap(parsed_, other->parsed_);
499 std::swap(inner_url_, other->inner_url_); 506 std::swap(inner_url_, other->inner_url_);
500 } 507 }
501 508
502 std::ostream& operator<<(std::ostream& out, const GURL& url) { 509 std::ostream& operator<<(std::ostream& out, const GURL& url) {
503 return out << url.possibly_invalid_spec(); 510 return out << url.possibly_invalid_spec();
504 } 511 }
OLDNEW
« chrome/browser/translate/translate_manager.cc ('K') | « url/gurl.h ('k') | url/url_parse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698