OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_split.h" | 10 #include "base/string_split.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } else { | 128 } else { |
129 BrowserThread::PostTask( | 129 BrowserThread::PostTask( |
130 BrowserThread::UI, FROM_HERE, | 130 BrowserThread::UI, FROM_HERE, |
131 NewRunnableMethod(this, &Toolbar5Importer::Cancel)); | 131 NewRunnableMethod(this, &Toolbar5Importer::Cancel)); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 void Toolbar5Importer::OnURLFetchComplete( | 135 void Toolbar5Importer::OnURLFetchComplete( |
136 const URLFetcher* source, | 136 const URLFetcher* source, |
137 const GURL& url, | 137 const GURL& url, |
138 const URLRequestStatus& status, | 138 const net::URLRequestStatus& status, |
139 int response_code, | 139 int response_code, |
140 const ResponseCookies& cookies, | 140 const ResponseCookies& cookies, |
141 const std::string& data) { | 141 const std::string& data) { |
142 if (cancelled()) { | 142 if (cancelled()) { |
143 EndImport(); | 143 EndImport(); |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 if (200 != response_code) { // HTTP/Ok | 147 if (200 != response_code) { // HTTP/Ok |
148 // Cancelling here will update the UI and bypass the rest of bookmark | 148 // Cancelling here will update the UI and bypass the rest of bookmark |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 void Toolbar5Importer::AddBookmarksToChrome( | 593 void Toolbar5Importer::AddBookmarksToChrome( |
594 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks) { | 594 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks) { |
595 if (!bookmarks.empty() && !cancelled()) { | 595 if (!bookmarks.empty() && !cancelled()) { |
596 const std::wstring& first_folder_name = | 596 const std::wstring& first_folder_name = |
597 bridge_->GetLocalizedString(IDS_BOOKMARK_GROUP_FROM_GOOGLE_TOOLBAR); | 597 bridge_->GetLocalizedString(IDS_BOOKMARK_GROUP_FROM_GOOGLE_TOOLBAR); |
598 int options = ProfileWriter::ADD_IF_UNIQUE | | 598 int options = ProfileWriter::ADD_IF_UNIQUE | |
599 (import_to_bookmark_bar() ? ProfileWriter::IMPORT_TO_BOOKMARK_BAR : 0); | 599 (import_to_bookmark_bar() ? ProfileWriter::IMPORT_TO_BOOKMARK_BAR : 0); |
600 bridge_->AddBookmarkEntries(bookmarks, first_folder_name, options); | 600 bridge_->AddBookmarkEntries(bookmarks, first_folder_name, options); |
601 } | 601 } |
602 } | 602 } |
OLD | NEW |