OLD | NEW |
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/importer/toolbar_importer.h" | 5 #include "chrome/browser/importer/toolbar_importer.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 std::string random_string = base::UintToString(random); | 202 std::string random_string = base::UintToString(random); |
203 | 203 |
204 // Retrieve authorization token from the network. | 204 // Retrieve authorization token from the network. |
205 std::string url_string(kT5AuthorizationTokenUrl); | 205 std::string url_string(kT5AuthorizationTokenUrl); |
206 url_string.replace(url_string.find(kRandomNumberToken), | 206 url_string.replace(url_string.find(kRandomNumberToken), |
207 arraysize(kRandomNumberToken) - 1, | 207 arraysize(kRandomNumberToken) - 1, |
208 random_string); | 208 random_string); |
209 GURL url(url_string); | 209 GURL url(url_string); |
210 | 210 |
211 token_fetcher_ = new URLFetcher(url, URLFetcher::GET, this); | 211 token_fetcher_ = new URLFetcher(url, URLFetcher::GET, this); |
212 token_fetcher_->set_request_context(Profile::GetDefaultRequestContext()); | 212 token_fetcher_->set_request_context( |
| 213 Profile::Deprecated::GetDefaultRequestContext()); |
213 token_fetcher_->Start(); | 214 token_fetcher_->Start(); |
214 } | 215 } |
215 | 216 |
216 void Toolbar5Importer::GetBookmarkDataFromServer(const std::string& response) { | 217 void Toolbar5Importer::GetBookmarkDataFromServer(const std::string& response) { |
217 if (cancelled()) { | 218 if (cancelled()) { |
218 EndImport(); | 219 EndImport(); |
219 return; | 220 return; |
220 } | 221 } |
221 | 222 |
222 state_ = GET_BOOKMARKS; | 223 state_ = GET_BOOKMARKS; |
(...skipping 12 matching lines...) Expand all Loading... |
235 std::string random_string = base::UintToString(random); | 236 std::string random_string = base::UintToString(random); |
236 conn_string.replace(conn_string.find(kRandomNumberToken), | 237 conn_string.replace(conn_string.find(kRandomNumberToken), |
237 arraysize(kRandomNumberToken) - 1, | 238 arraysize(kRandomNumberToken) - 1, |
238 random_string); | 239 random_string); |
239 conn_string.replace(conn_string.find(kAuthorizationToken), | 240 conn_string.replace(conn_string.find(kAuthorizationToken), |
240 arraysize(kAuthorizationToken) - 1, | 241 arraysize(kAuthorizationToken) - 1, |
241 token); | 242 token); |
242 GURL url(conn_string); | 243 GURL url(conn_string); |
243 | 244 |
244 data_fetcher_ = new URLFetcher(url, URLFetcher::GET, this); | 245 data_fetcher_ = new URLFetcher(url, URLFetcher::GET, this); |
245 data_fetcher_->set_request_context(Profile::GetDefaultRequestContext()); | 246 data_fetcher_->set_request_context( |
| 247 Profile::Deprecated::GetDefaultRequestContext()); |
246 data_fetcher_->Start(); | 248 data_fetcher_->Start(); |
247 } | 249 } |
248 | 250 |
249 void Toolbar5Importer::GetBookmarksFromServerDataResponse( | 251 void Toolbar5Importer::GetBookmarksFromServerDataResponse( |
250 const std::string& response) { | 252 const std::string& response) { |
251 if (cancelled()) { | 253 if (cancelled()) { |
252 EndImport(); | 254 EndImport(); |
253 return; | 255 return; |
254 } | 256 } |
255 | 257 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } | 554 } |
553 | 555 |
554 void Toolbar5Importer::AddBookmarksToChrome( | 556 void Toolbar5Importer::AddBookmarksToChrome( |
555 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks) { | 557 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks) { |
556 if (!bookmarks.empty() && !cancelled()) { | 558 if (!bookmarks.empty() && !cancelled()) { |
557 const string16& first_folder_name = | 559 const string16& first_folder_name = |
558 bridge_->GetLocalizedString(IDS_BOOKMARK_GROUP_FROM_GOOGLE_TOOLBAR); | 560 bridge_->GetLocalizedString(IDS_BOOKMARK_GROUP_FROM_GOOGLE_TOOLBAR); |
559 bridge_->AddBookmarks(bookmarks, first_folder_name); | 561 bridge_->AddBookmarks(bookmarks, first_folder_name); |
560 } | 562 } |
561 } | 563 } |
OLD | NEW |