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

Side by Side Diff: chrome/browser/ui/webui/options/startup_pages_handler.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
« no previous file with comments | « chrome/browser/ui/webui/options/core_options_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/webui/options/startup_pages_handler.h" 5 #include "chrome/browser/ui/webui/options/startup_pages_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" 10 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
11 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 11 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/custom_home_pages_table_model.h" 13 #include "chrome/browser/custom_home_pages_table_model.h"
14 #include "chrome/browser/prefs/session_startup_pref.h" 14 #include "chrome/browser/prefs/session_startup_pref.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/search_engines/template_url_service_factory.h" 16 #include "chrome/browser/search_engines/template_url_service_factory.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
19 #include "components/metrics/proto/omnibox_event.pb.h" 19 #include "components/metrics/proto/omnibox_event.pb.h"
20 #include "components/omnibox/browser/autocomplete_classifier.h" 20 #include "components/omnibox/browser/autocomplete_classifier.h"
21 #include "components/omnibox/browser/autocomplete_controller.h" 21 #include "components/omnibox/browser/autocomplete_controller.h"
22 #include "components/omnibox/browser/autocomplete_input.h" 22 #include "components/omnibox/browser/autocomplete_input.h"
23 #include "components/omnibox/browser/autocomplete_result.h" 23 #include "components/omnibox/browser/autocomplete_result.h"
24 #include "components/url_fixer/url_fixer.h" 24 #include "components/url_formatter/url_fixer.h"
25 #include "content/public/browser/notification_details.h" 25 #include "content/public/browser/notification_details.h"
26 #include "content/public/browser/web_ui.h" 26 #include "content/public/browser/web_ui.h"
27 27
28 namespace options { 28 namespace options {
29 29
30 StartupPagesHandler::StartupPagesHandler() { 30 StartupPagesHandler::StartupPagesHandler() {
31 } 31 }
32 32
33 StartupPagesHandler::~StartupPagesHandler() { 33 StartupPagesHandler::~StartupPagesHandler() {
34 } 34 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return; 156 return;
157 } 157 }
158 startup_custom_pages_table_model_->Remove(selected_index); 158 startup_custom_pages_table_model_->Remove(selected_index);
159 } 159 }
160 } 160 }
161 161
162 void StartupPagesHandler::AddStartupPage(const base::ListValue* args) { 162 void StartupPagesHandler::AddStartupPage(const base::ListValue* args) {
163 std::string url_string; 163 std::string url_string;
164 CHECK(args->GetString(0, &url_string)); 164 CHECK(args->GetString(0, &url_string));
165 165
166 GURL url = url_fixer::FixupURL(url_string, std::string()); 166 GURL url = url_formatter::FixupURL(url_string, std::string());
167 if (!url.is_valid()) 167 if (!url.is_valid())
168 return; 168 return;
169 169
170 int row_count = startup_custom_pages_table_model_->RowCount(); 170 int row_count = startup_custom_pages_table_model_->RowCount();
171 int index; 171 int index;
172 if (!args->GetInteger(1, &index) || index > row_count) 172 if (!args->GetInteger(1, &index) || index > row_count)
173 index = row_count; 173 index = row_count;
174 174
175 startup_custom_pages_table_model_->Add(index, url); 175 startup_custom_pages_table_model_->Add(index, url);
176 } 176 }
177 177
178 void StartupPagesHandler::EditStartupPage(const base::ListValue* args) { 178 void StartupPagesHandler::EditStartupPage(const base::ListValue* args) {
179 std::string url_string; 179 std::string url_string;
180 GURL fixed_url; 180 GURL fixed_url;
181 int index; 181 int index;
182 CHECK_EQ(args->GetSize(), 2U); 182 CHECK_EQ(args->GetSize(), 2U);
183 CHECK(args->GetInteger(0, &index)); 183 CHECK(args->GetInteger(0, &index));
184 CHECK(args->GetString(1, &url_string)); 184 CHECK(args->GetString(1, &url_string));
185 185
186 if (index < 0 || index > startup_custom_pages_table_model_->RowCount()) { 186 if (index < 0 || index > startup_custom_pages_table_model_->RowCount()) {
187 NOTREACHED(); 187 NOTREACHED();
188 return; 188 return;
189 } 189 }
190 190
191 fixed_url = url_fixer::FixupURL(url_string, std::string()); 191 fixed_url = url_formatter::FixupURL(url_string, std::string());
192 if (!fixed_url.is_empty()) { 192 if (!fixed_url.is_empty()) {
193 std::vector<GURL> urls = startup_custom_pages_table_model_->GetURLs(); 193 std::vector<GURL> urls = startup_custom_pages_table_model_->GetURLs();
194 urls[index] = fixed_url; 194 urls[index] = fixed_url;
195 startup_custom_pages_table_model_->SetURLs(urls); 195 startup_custom_pages_table_model_->SetURLs(urls);
196 } else { 196 } else {
197 startup_custom_pages_table_model_->Remove(index); 197 startup_custom_pages_table_model_->Remove(index);
198 } 198 }
199 } 199 }
200 200
201 void StartupPagesHandler::DragDropStartupPage(const base::ListValue* args) { 201 void StartupPagesHandler::DragDropStartupPage(const base::ListValue* args) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { 253 void StartupPagesHandler::OnResultChanged(bool default_match_changed) {
254 const AutocompleteResult& result = autocomplete_controller_->result(); 254 const AutocompleteResult& result = autocomplete_controller_->result();
255 base::ListValue suggestions; 255 base::ListValue suggestions;
256 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); 256 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions);
257 web_ui()->CallJavascriptFunction( 257 web_ui()->CallJavascriptFunction(
258 "StartupOverlay.updateAutocompleteSuggestions", suggestions); 258 "StartupOverlay.updateAutocompleteSuggestions", suggestions);
259 } 259 }
260 260
261 } // namespace options 261 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/core_options_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698