| Index: trunk/src/chrome/browser/ui/webui/options/import_data_handler.cc
|
| ===================================================================
|
| --- trunk/src/chrome/browser/ui/webui/options/import_data_handler.cc (revision 216877)
|
| +++ trunk/src/chrome/browser/ui/webui/options/import_data_handler.cc (working copy)
|
| @@ -22,8 +22,6 @@
|
| #include "chrome/browser/importer/importer_uma.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/browser_finder.h"
|
| -#include "chrome/browser/ui/browser_window.h"
|
| -#include "chrome/browser/ui/chrome_select_file_policy.h"
|
| #include "content/public/browser/web_ui.h"
|
| #include "grit/chromium_strings.h"
|
| #include "grit/generated_resources.h"
|
| @@ -36,14 +34,11 @@
|
| }
|
|
|
| ImportDataHandler::~ImportDataHandler() {
|
| - if (importer_list_)
|
| + if (importer_list_.get())
|
| importer_list_->set_observer(NULL);
|
|
|
| if (importer_host_)
|
| importer_host_->set_observer(NULL);
|
| -
|
| - if (select_file_dialog_)
|
| - select_file_dialog_->ListenerDestroyed();
|
| }
|
|
|
| void ImportDataHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
|
| @@ -57,7 +52,6 @@
|
| { "importFavorites", IDS_IMPORT_FAVORITES_CHKBOX },
|
| { "importSearch", IDS_IMPORT_SEARCH_ENGINES_CHKBOX },
|
| { "importPasswords", IDS_IMPORT_PASSWORDS_CHKBOX },
|
| - { "importChooseFile", IDS_IMPORT_CHOOSE_FILE },
|
| { "importCommit", IDS_IMPORT_COMMIT },
|
| { "noProfileFound", IDS_IMPORT_NO_PROFILE_FOUND },
|
| { "importSucceeded", IDS_IMPORT_SUCCEEDED },
|
| @@ -77,13 +71,8 @@
|
| }
|
|
|
| void ImportDataHandler::RegisterMessages() {
|
| - web_ui()->RegisterMessageCallback(
|
| - "importData",
|
| + web_ui()->RegisterMessageCallback("importData",
|
| base::Bind(&ImportDataHandler::ImportData, base::Unretained(this)));
|
| - web_ui()->RegisterMessageCallback(
|
| - "chooseBookmarksFile",
|
| - base::Bind(&ImportDataHandler::HandleChooseBookmarksFile,
|
| - base::Unretained(this)));
|
| }
|
|
|
| void ImportDataHandler::ImportData(const ListValue* args) {
|
| @@ -202,47 +191,4 @@
|
| }
|
| }
|
|
|
| -void ImportDataHandler::FileSelected(const base::FilePath& path,
|
| - int index,
|
| - void* params) {
|
| - base::FundamentalValue importing(true);
|
| - web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState",
|
| - importing);
|
| - import_did_succeed_ = false;
|
| -
|
| - importer_host_ = new ExternalProcessImporterHost();
|
| - importer_host_->set_observer(this);
|
| -
|
| - importer::SourceProfile source_profile;
|
| - source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE;
|
| - source_profile.source_path = path;
|
| -
|
| - Profile* profile = Profile::FromWebUI(web_ui());
|
| -
|
| - importer_host_->StartImportSettings(
|
| - source_profile, profile, importer::FAVORITES, new ProfileWriter(profile));
|
| -}
|
| -
|
| -void ImportDataHandler::HandleChooseBookmarksFile(const base::ListValue* args) {
|
| - DCHECK(args && args->empty());
|
| - select_file_dialog_ = ui::SelectFileDialog::Create(
|
| - this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
|
| -
|
| - ui::SelectFileDialog::FileTypeInfo file_type_info;
|
| - file_type_info.extensions.resize(1);
|
| - file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html"));
|
| -
|
| - Browser* browser =
|
| - chrome::FindBrowserWithWebContents(web_ui()->GetWebContents());
|
| -
|
| - select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE,
|
| - base::string16(),
|
| - base::FilePath(),
|
| - &file_type_info,
|
| - 0,
|
| - base::FilePath::StringType(),
|
| - browser->window()->GetNativeWindow(),
|
| - NULL);
|
| -}
|
| -
|
| } // namespace options
|
|
|