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

Side by Side Diff: chrome/browser/autocomplete/builtin_provider.cc

Issue 8573021: chrome: Remove 14 exit time destructors and 2 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Hopefully fix problems seen on the bots Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autocomplete/builtin_provider.h" 5 #include "chrome/browser/autocomplete/builtin_provider.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_about_handler.h" 9 #include "chrome/browser/browser_about_handler.h"
10 #include "chrome/browser/net/url_fixer_upper.h" 10 #include "chrome/browser/net/url_fixer_upper.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 void BuiltinProvider::Start(const AutocompleteInput& input, 57 void BuiltinProvider::Start(const AutocompleteInput& input,
58 bool minimal_changes) { 58 bool minimal_changes) {
59 matches_.clear(); 59 matches_.clear();
60 if ((input.type() == AutocompleteInput::INVALID) || 60 if ((input.type() == AutocompleteInput::INVALID) ||
61 (input.type() == AutocompleteInput::FORCED_QUERY) || 61 (input.type() == AutocompleteInput::FORCED_QUERY) ||
62 (input.type() == AutocompleteInput::QUERY) || 62 (input.type() == AutocompleteInput::QUERY) ||
63 (input.matches_requested() == AutocompleteInput::BEST_MATCH)) 63 (input.matches_requested() == AutocompleteInput::BEST_MATCH))
64 return; 64 return;
65 65
66 static const string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme) + 66 const string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme) +
67 ASCIIToUTF16(chrome::kStandardSchemeSeparator); 67 ASCIIToUTF16(chrome::kStandardSchemeSeparator);
68 static const string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme) + 68 const string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme) +
69 ASCIIToUTF16(chrome::kStandardSchemeSeparator); 69 ASCIIToUTF16(chrome::kStandardSchemeSeparator);
70 70
71 static const int kUrl = ACMatchClassification::URL; 71 const int kUrl = ACMatchClassification::URL;
72 static const int kMatch = kUrl | ACMatchClassification::MATCH; 72 const int kMatch = kUrl | ACMatchClassification::MATCH;
73 73
74 string16 text = input.text(); 74 string16 text = input.text();
75 bool starting_chrome = StartsWith(kChrome, text, false); 75 bool starting_chrome = StartsWith(kChrome, text, false);
76 if (starting_chrome || StartsWith(kAbout, text, false)) { 76 if (starting_chrome || StartsWith(kAbout, text, false)) {
77 ACMatchClassifications styles; 77 ACMatchClassifications styles;
78 // Highlight the input portion matching "chrome://"; or if the user has 78 // Highlight the input portion matching "chrome://"; or if the user has
79 // input "about:" (with optional slashes), highlight the whole "chrome://". 79 // input "about:" (with optional slashes), highlight the whole "chrome://".
80 static const size_t kAboutSchemeLength = strlen(chrome::kAboutScheme); 80 const size_t kAboutSchemeLength = strlen(chrome::kAboutScheme);
81 bool highlight = starting_chrome || text.length() > kAboutSchemeLength; 81 bool highlight = starting_chrome || text.length() > kAboutSchemeLength;
82 styles.push_back(ACMatchClassification(0, highlight ? kMatch : kUrl)); 82 styles.push_back(ACMatchClassification(0, highlight ? kMatch : kUrl));
83 size_t offset = starting_chrome ? text.length() : kChrome.length(); 83 size_t offset = starting_chrome ? text.length() : kChrome.length();
84 if (highlight) 84 if (highlight)
85 styles.push_back(ACMatchClassification(offset, kUrl)); 85 styles.push_back(ACMatchClassification(offset, kUrl));
86 // Include some common builtin chrome URLs as the user types the scheme. 86 // Include some common builtin chrome URLs as the user types the scheme.
87 AddMatch(ASCIIToUTF16(chrome::kChromeUIChromeURLsURL), styles); 87 AddMatch(ASCIIToUTF16(chrome::kChromeUIChromeURLsURL), styles);
88 AddMatch(ASCIIToUTF16(chrome::kChromeUISettingsURL), styles); 88 AddMatch(ASCIIToUTF16(chrome::kChromeUISettingsURL), styles);
89 AddMatch(ASCIIToUTF16(chrome::kChromeUIVersionURL), styles); 89 AddMatch(ASCIIToUTF16(chrome::kChromeUIVersionURL), styles);
90 } else { 90 } else {
(...skipping 26 matching lines...) Expand all
117 void BuiltinProvider::AddMatch(const string16& match_string, 117 void BuiltinProvider::AddMatch(const string16& match_string,
118 const ACMatchClassifications& styles) { 118 const ACMatchClassifications& styles) {
119 AutocompleteMatch match(this, kRelevance, false, 119 AutocompleteMatch match(this, kRelevance, false,
120 AutocompleteMatch::NAVSUGGEST); 120 AutocompleteMatch::NAVSUGGEST);
121 match.fill_into_edit = match_string; 121 match.fill_into_edit = match_string;
122 match.destination_url = GURL(match_string); 122 match.destination_url = GURL(match_string);
123 match.contents = match_string; 123 match.contents = match_string;
124 match.contents_class = styles; 124 match.contents_class = styles;
125 matches_.push_back(match); 125 matches_.push_back(match);
126 } 126 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider.cc » ('j') | chrome/browser/google/google_update_settings_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698