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
3// found in the LICENSE file.
4
5#include "chrome/browser/importer/profile_import_process_client.h"
6
7#include "chrome/browser/history/history_types.h"
8#include "chrome/browser/importer/profile_import_process_host.h"
9#include "chrome/browser/importer/profile_import_process_messages.h"
10#include "chrome/browser/search_engines/template_url.h"
11#include "googleurl/src/gurl.h"
12#include "ipc/ipc_message_macros.h"
13#include "webkit/glue/password_form.h"
14
15ProfileImportProcessClient::ProfileImportProcessClient() {
16}
17
18void ProfileImportProcessClient::OnProcessCrashed(int exit_status) {
19}
20
21void ProfileImportProcessClient::OnImportStart() {
22}
23
24void ProfileImportProcessClient::OnImportFinished(
25    bool succeeded,
26    const std::string& error_msg) {
27}
28
29void ProfileImportProcessClient::OnImportItemStart(int item) {
30}
31
32void ProfileImportProcessClient::OnImportItemFinished(int item) {
33}
34
35void ProfileImportProcessClient::OnImportItemFailed(
36    const std::string& error_msg) {
37}
38
39void ProfileImportProcessClient::OnHistoryImportStart(
40    size_t total_history_rows_count) {
41}
42
43void ProfileImportProcessClient::OnHistoryImportGroup(
44    const std::vector<history::URLRow>& history_rows_group,
45    int visit_source) {
46}
47
48void ProfileImportProcessClient::OnHomePageImportReady(const GURL& home_page) {
49}
50
51void ProfileImportProcessClient::OnBookmarksImportStart(
52    const string16& first_folder_name,
53    int options,
54    size_t total_bookmarks_count) {
55}
56
57void ProfileImportProcessClient::OnBookmarksImportGroup(
58    const std::vector<ProfileWriter::BookmarkEntry>& bookmarks) {
59}
60
61void ProfileImportProcessClient::OnFaviconsImportStart(
62    size_t total_favicons_count) {
63}
64
65void ProfileImportProcessClient::OnFaviconsImportGroup(
66    const std::vector<history::ImportedFaviconUsage>& favicons_group) {
67}
68
69void ProfileImportProcessClient::OnPasswordFormImportReady(
70    const webkit_glue::PasswordForm& form) {
71}
72
73void ProfileImportProcessClient::OnKeywordsImportReady(
74    const std::vector<TemplateURL>& template_urls,
75    int default_keyword_index,
76    bool unique_on_host_and_path) {
77}
78
79bool ProfileImportProcessClient::OnMessageReceived(
80    const IPC::Message& message) {
81  bool handled = true;
82  IPC_BEGIN_MESSAGE_MAP(ProfileImportProcessClient, message)
83    // Notification messages about the state of the import process.
84    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Started,
85                        OnImportStart)
86    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Finished,
87                        OnImportFinished)
88    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_ImportItem_Started,
89                        OnImportItemStart)
90    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_ImportItem_Finished,
91                        OnImportItemFinished)
92
93    // Data messages containing items to be written to the user profile.
94    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyHistoryImportStart,
95                        OnHistoryImportStart)
96    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyHistoryImportGroup,
97                        OnHistoryImportGroup)
98    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyHomePageImportReady,
99                        OnHomePageImportReady)
100    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyBookmarksImportStart,
101                        OnBookmarksImportStart)
102    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyBookmarksImportGroup,
103                        OnBookmarksImportGroup)
104    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportStart,
105                        OnFaviconsImportStart)
106    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup,
107                        OnFaviconsImportGroup)
108    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyPasswordFormReady,
109                        OnPasswordFormImportReady)
110    IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady,
111                        OnKeywordsImportReady)
112    IPC_MESSAGE_UNHANDLED(handled = false)
113  IPC_END_MESSAGE_MAP_EX()
114  return handled;
115}
116
117ProfileImportProcessClient::~ProfileImportProcessClient() {
118}
119