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

Side by Side Diff: chrome/browser/dom_ui/options/import_data_handler.cc

Issue 5606008: DOMUI: Clean up importer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/import_data_overlay.html » ('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) 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/dom_ui/options/import_data_handler.h" 5 #include "chrome/browser/dom_ui/options/import_data_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 ImportDataHandler::~ImportDataHandler() { 26 ImportDataHandler::~ImportDataHandler() {
27 if (importer_host_) 27 if (importer_host_)
28 importer_host_->SetObserver(NULL); 28 importer_host_->SetObserver(NULL);
29 } 29 }
30 30
31 void ImportDataHandler::GetLocalizedValues( 31 void ImportDataHandler::GetLocalizedValues(
32 DictionaryValue* localized_strings) { 32 DictionaryValue* localized_strings) {
33 DCHECK(localized_strings); 33 DCHECK(localized_strings);
34 localized_strings->SetString("import_data_title", 34 localized_strings->SetString("importDataTitle",
35 l10n_util::GetStringUTF16(IDS_IMPORT_SETTINGS_TITLE)); 35 l10n_util::GetStringUTF16(IDS_IMPORT_SETTINGS_TITLE));
36 localized_strings->SetString("import_from_label", 36 localized_strings->SetString("importFromLabel",
37 l10n_util::GetStringUTF16(IDS_IMPORT_FROM_LABEL)); 37 l10n_util::GetStringUTF16(IDS_IMPORT_FROM_LABEL));
38 localized_strings->SetString("import_commit", 38 localized_strings->SetString("importDescription",
39 l10n_util::GetStringUTF16(IDS_IMPORT_ITEMS_LABEL));
40 localized_strings->SetString("importHistory",
41 l10n_util::GetStringUTF16(IDS_IMPORT_HISTORY_CHKBOX));
42 localized_strings->SetString("importFavorites",
43 l10n_util::GetStringUTF16(IDS_IMPORT_FAVORITES_CHKBOX));
44 localized_strings->SetString("importSearch",
45 l10n_util::GetStringUTF16(IDS_IMPORT_SEARCH_ENGINES_CHKBOX));
46 localized_strings->SetString("importPasswords",
47 l10n_util::GetStringUTF16(IDS_IMPORT_PASSWORDS_CHKBOX));
48 localized_strings->SetString("importCommit",
39 l10n_util::GetStringUTF16(IDS_IMPORT_COMMIT)); 49 l10n_util::GetStringUTF16(IDS_IMPORT_COMMIT));
40 localized_strings->SetString("import_description", 50 localized_strings->SetString("noProfileFound",
41 l10n_util::GetStringUTF16(IDS_IMPORT_ITEMS_LABEL));
42 localized_strings->SetString("import_favorites",
43 l10n_util::GetStringUTF16(IDS_IMPORT_FAVORITES_CHKBOX));
44 localized_strings->SetString("import_search",
45 l10n_util::GetStringUTF16(IDS_IMPORT_SEARCH_ENGINES_CHKBOX));
46 localized_strings->SetString("import_passwords",
47 l10n_util::GetStringUTF16(IDS_IMPORT_PASSWORDS_CHKBOX));
48 localized_strings->SetString("import_history",
49 l10n_util::GetStringUTF16(IDS_IMPORT_HISTORY_CHKBOX));
50 localized_strings->SetString("no_profile_found",
51 l10n_util::GetStringUTF16(IDS_IMPORT_NO_PROFILE_FOUND)); 51 l10n_util::GetStringUTF16(IDS_IMPORT_NO_PROFILE_FOUND));
52 } 52 }
53 53
54 void ImportDataHandler::Initialize() { 54 void ImportDataHandler::Initialize() {
55 importer_list_.reset(new ImporterList); 55 importer_list_.reset(new ImporterList);
56 56
57 // The ImporterHost object creates an ImporterList, which calls PathExists 57 // The ImporterHost object creates an ImporterList, which calls PathExists
58 // one or more times. Because we are currently in the UI thread, this will 58 // one or more times. Because we are currently in the UI thread, this will
59 // trigger a DCHECK due to IO being done on the UI thread. For now we will 59 // trigger a DCHECK due to IO being done on the UI thread. For now we will
60 // supress the DCHECK. See the following bug for more detail: 60 // suppress the DCHECK. See the following bug for more detail:
61 // http://crbug.com/60825 61 // http://crbug.com/60825
62 base::ThreadRestrictions::ScopedAllowIO allow_io; 62 base::ThreadRestrictions::ScopedAllowIO allow_io;
63 importer_list_->DetectSourceProfiles(); 63 importer_list_->DetectSourceProfiles();
64 int profiles_count = importer_list_->GetAvailableProfileCount(); 64 int profiles_count = importer_list_->GetAvailableProfileCount();
65 65
66 ListValue browser_profiles; 66 ListValue browser_profiles;
67 if (profiles_count > 0) { 67 if (profiles_count > 0) {
68 for (int i = 0; i < profiles_count; i++) { 68 for (int i = 0; i < profiles_count; i++) {
69 const importer::ProfileInfo& source_profile = 69 const importer::ProfileInfo& source_profile =
70 importer_list_->GetSourceProfileInfoAt(i); 70 importer_list_->GetSourceProfileInfoAt(i);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void ImportDataHandler::ImportItemEnded(importer::ImportItem item) { 168 void ImportDataHandler::ImportItemEnded(importer::ImportItem item) {
169 // TODO(csilv): show progress detail in the web view. 169 // TODO(csilv): show progress detail in the web view.
170 } 170 }
171 171
172 void ImportDataHandler::ImportEnded() { 172 void ImportDataHandler::ImportEnded() {
173 importer_host_->SetObserver(NULL); 173 importer_host_->SetObserver(NULL);
174 importer_host_ = NULL; 174 importer_host_ = NULL;
175 175
176 dom_ui_->CallJavascriptFunction(L"ImportDataOverlay.dismiss"); 176 dom_ui_->CallJavascriptFunction(L"ImportDataOverlay.dismiss");
177 } 177 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/import_data_overlay.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698