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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_model_impl.cc

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 years, 4 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 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/toolbar/toolbar_model_impl.h" 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 10 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/search/search.h" 12 #include "chrome/browser/search/search.h"
13 #include "chrome/browser/ssl/connection_security.h" 13 #include "chrome/browser/ssl/connection_security.h"
14 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" 14 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
18 #include "components/google/core/browser/google_util.h" 18 #include "components/google/core/browser/google_util.h"
19 #include "components/omnibox/browser/autocomplete_classifier.h" 19 #include "components/omnibox/browser/autocomplete_classifier.h"
20 #include "components/omnibox/browser/autocomplete_input.h" 20 #include "components/omnibox/browser/autocomplete_input.h"
21 #include "components/omnibox/browser/autocomplete_match.h" 21 #include "components/omnibox/browser/autocomplete_match.h"
22 #include "components/url_formatter/url_formatter.h"
22 #include "content/public/browser/cert_store.h" 23 #include "content/public/browser/cert_store.h"
23 #include "content/public/browser/navigation_controller.h" 24 #include "content/public/browser/navigation_controller.h"
24 #include "content/public/browser/navigation_entry.h" 25 #include "content/public/browser/navigation_entry.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "content/public/browser/web_ui.h" 27 #include "content/public/browser/web_ui.h"
27 #include "content/public/common/content_constants.h" 28 #include "content/public/common/content_constants.h"
28 #include "content/public/common/ssl_status.h" 29 #include "content/public/common/ssl_status.h"
29 #include "grit/components_scaled_resources.h" 30 #include "grit/components_scaled_resources.h"
30 #include "grit/theme_resources.h" 31 #include "grit/theme_resources.h"
31 #include "net/base/net_util.h"
32 #include "net/cert/cert_status_flags.h" 32 #include "net/cert/cert_status_flags.h"
33 #include "net/cert/x509_certificate.h" 33 #include "net/cert/x509_certificate.h"
34 #include "net/ssl/ssl_connection_status_flags.h" 34 #include "net/ssl/ssl_connection_status_flags.h"
35 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
36 36
37 using content::NavigationController; 37 using content::NavigationController;
38 using content::NavigationEntry; 38 using content::NavigationEntry;
39 using content::WebContents; 39 using content::WebContents;
40 40
41 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate) 41 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate)
(...skipping 18 matching lines...) Expand all
60 if (profile) 60 if (profile)
61 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); 61 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
62 62
63 GURL url(GetURL()); 63 GURL url(GetURL());
64 if (url.spec().length() > content::kMaxURLDisplayChars) 64 if (url.spec().length() > content::kMaxURLDisplayChars)
65 url = url.IsStandard() ? url.GetOrigin() : GURL(url.scheme() + ":"); 65 url = url.IsStandard() ? url.GetOrigin() : GURL(url.scheme() + ":");
66 // Note that we can't unescape spaces here, because if the user copies this 66 // Note that we can't unescape spaces here, because if the user copies this
67 // and pastes it into another program, that program may think the URL ends at 67 // and pastes it into another program, that program may think the URL ends at
68 // the space. 68 // the space.
69 return AutocompleteInput::FormattedStringWithEquivalentMeaning( 69 return AutocompleteInput::FormattedStringWithEquivalentMeaning(
70 url, net::FormatUrl(url, languages, net::kFormatUrlOmitAll, 70 url, url_formatter::FormatUrl(
71 net::UnescapeRule::NORMAL, NULL, prefix_end, NULL), 71 url, languages, url_formatter::kFormatUrlOmitAll,
72 net::UnescapeRule::NORMAL, nullptr, prefix_end, nullptr),
72 ChromeAutocompleteSchemeClassifier(profile)); 73 ChromeAutocompleteSchemeClassifier(profile));
73 } 74 }
74 75
75 base::string16 ToolbarModelImpl::GetCorpusNameForMobile() const { 76 base::string16 ToolbarModelImpl::GetCorpusNameForMobile() const {
76 if (!WouldPerformSearchTermReplacement(false)) 77 if (!WouldPerformSearchTermReplacement(false))
77 return base::string16(); 78 return base::string16();
78 GURL url(GetURL()); 79 GURL url(GetURL());
79 // If there is a query in the url fragment look for the corpus name there, 80 // If there is a query in the url fragment look for the corpus name there,
80 // otherwise look for the corpus name in the query parameters. 81 // otherwise look for the corpus name in the query parameters.
81 const std::string& query_str(google_util::HasGoogleSearchQueryParam( 82 const std::string& query_str(google_util::HasGoogleSearchQueryParam(
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 240
240 // Otherwise, extract search terms for HTTPS pages that do not have a security 241 // Otherwise, extract search terms for HTTPS pages that do not have a security
241 // error. 242 // error.
242 connection_security::SecurityLevel security_level = 243 connection_security::SecurityLevel security_level =
243 GetSecurityLevel(ignore_editing); 244 GetSecurityLevel(ignore_editing);
244 return ((security_level == connection_security::NONE) || 245 return ((security_level == connection_security::NONE) ||
245 (security_level == connection_security::SECURITY_ERROR)) 246 (security_level == connection_security::SECURITY_ERROR))
246 ? base::string16() 247 ? base::string16()
247 : search_terms; 248 : search_terms;
248 } 249 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698