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

Side by Side Diff: chrome/browser/importer/firefox3_importer.cc

Issue 280004: Revert wstring patch (r29078 and follow up commits). It is causing failures o... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/firefox3_importer.h" 5 #include "chrome/browser/importer/firefox3_importer.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 bridge_->NotifyItemStarted(PASSWORDS); 61 bridge_->NotifyItemStarted(PASSWORDS);
62 ImportPasswords(); 62 ImportPasswords();
63 bridge_->NotifyItemEnded(PASSWORDS); 63 bridge_->NotifyItemEnded(PASSWORDS);
64 } 64 }
65 bridge_->NotifyEnded(); 65 bridge_->NotifyEnded();
66 } 66 }
67 67
68 void Firefox3Importer::ImportHistory() { 68 void Firefox3Importer::ImportHistory() {
69 std::wstring file = source_path_; 69 std::wstring file = source_path_;
70 file_util::AppendToPath(&file, L"places.sqlite"); 70 file_util::AppendToPath(&file, L"places.sqlite");
71 if (!file_util::PathExists(FilePath::FromWStringHack(file))) 71 if (!file_util::PathExists(file))
72 return; 72 return;
73 73
74 sqlite3* sqlite; 74 sqlite3* sqlite;
75 if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK) 75 if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK)
76 return; 76 return;
77 sqlite_utils::scoped_sqlite_db_ptr db(sqlite); 77 sqlite_utils::scoped_sqlite_db_ptr db(sqlite);
78 78
79 SQLStatement s; 79 SQLStatement s;
80 // |visit_type| represent the transition type of URLs (typed, click, 80 // |visit_type| represent the transition type of URLs (typed, click,
81 // redirect, bookmark, etc.) We eliminate some URLs like sub-frames and 81 // redirect, bookmark, etc.) We eliminate some URLs like sub-frames and
(...skipping 27 matching lines...) Expand all
109 rows.push_back(row); 109 rows.push_back(row);
110 } 110 }
111 if (!rows.empty() && !cancelled()) { 111 if (!rows.empty() && !cancelled()) {
112 bridge_->SetHistoryItems(rows); 112 bridge_->SetHistoryItems(rows);
113 } 113 }
114 } 114 }
115 115
116 void Firefox3Importer::ImportBookmarks() { 116 void Firefox3Importer::ImportBookmarks() {
117 std::wstring file = source_path_; 117 std::wstring file = source_path_;
118 file_util::AppendToPath(&file, L"places.sqlite"); 118 file_util::AppendToPath(&file, L"places.sqlite");
119 if (!file_util::PathExists(FilePath::FromWStringHack(file))) 119 if (!file_util::PathExists(file))
120 return; 120 return;
121 121
122 sqlite3* sqlite; 122 sqlite3* sqlite;
123 if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK) 123 if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK)
124 return; 124 return;
125 sqlite_utils::scoped_sqlite_db_ptr db(sqlite); 125 sqlite_utils::scoped_sqlite_db_ptr db(sqlite);
126 126
127 // Get the bookmark folders that we are interested in. 127 // Get the bookmark folders that we are interested in.
128 int toolbar_folder_id = -1; 128 int toolbar_folder_id = -1;
129 int menu_folder_id = -1; 129 int menu_folder_id = -1;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 GURL home_page = GetHomepage(source_path_); 307 GURL home_page = GetHomepage(source_path_);
308 if (home_page.is_valid() && !IsDefaultHomepage(home_page, app_path_)) { 308 if (home_page.is_valid() && !IsDefaultHomepage(home_page, app_path_)) {
309 bridge_->AddHomePage(home_page); 309 bridge_->AddHomePage(home_page);
310 } 310 }
311 } 311 }
312 312
313 void Firefox3Importer::GetSearchEnginesXMLFiles( 313 void Firefox3Importer::GetSearchEnginesXMLFiles(
314 std::vector<std::wstring>* files) { 314 std::vector<std::wstring>* files) {
315 std::wstring file = source_path_; 315 std::wstring file = source_path_;
316 file_util::AppendToPath(&file, L"search.sqlite"); 316 file_util::AppendToPath(&file, L"search.sqlite");
317 if (!file_util::PathExists(FilePath::FromWStringHack(file))) 317 if (!file_util::PathExists(file))
318 return; 318 return;
319 319
320 sqlite3* sqlite; 320 sqlite3* sqlite;
321 if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK) 321 if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK)
322 return; 322 return;
323 sqlite_utils::scoped_sqlite_db_ptr db(sqlite); 323 sqlite_utils::scoped_sqlite_db_ptr db(sqlite);
324 324
325 SQLStatement s; 325 SQLStatement s;
326 const char* stmt = "SELECT engineid FROM engine_data " 326 const char* stmt = "SELECT engineid FROM engine_data "
327 "WHERE engineid NOT IN " 327 "WHERE engineid NOT IN "
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 514
515 if (!ReencodeFavicon(&data[0], data.size(), &usage.png_data)) 515 if (!ReencodeFavicon(&data[0], data.size(), &usage.png_data))
516 continue; // Unable to decode. 516 continue; // Unable to decode.
517 517
518 usage.urls = i->second; 518 usage.urls = i->second;
519 favicons->push_back(usage); 519 favicons->push_back(usage);
520 } 520 }
521 s.reset(); 521 s.reset();
522 } 522 }
523 } 523 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox2_importer.cc ('k') | chrome/browser/importer/importer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698