OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/utility/profile_import_handler.h" | 5 #include "chrome/utility/profile_import_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 void ProfileImportHandler::OnImportCancel() { | 63 void ProfileImportHandler::OnImportCancel() { |
64 ImporterCleanup(); | 64 ImporterCleanup(); |
65 } | 65 } |
66 | 66 |
67 void ProfileImportHandler::OnImportItemFinished(uint16 item) { | 67 void ProfileImportHandler::OnImportItemFinished(uint16 item) { |
68 items_to_import_ ^= item; // Remove finished item from mask. | 68 items_to_import_ ^= item; // Remove finished item from mask. |
69 // If we've finished with all items, notify the browser process. | 69 // If we've finished with all items, notify the browser process. |
70 if (items_to_import_ == 0) { | 70 if (items_to_import_ == 0) { |
71 Send(new ProfileImportProcessHostMsg_Import_Finished(true, "")); | 71 Send(new ProfileImportProcessHostMsg_Import_Finished(true, std::string())); |
72 ImporterCleanup(); | 72 ImporterCleanup(); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 void ProfileImportHandler::ImporterCleanup() { | 76 void ProfileImportHandler::ImporterCleanup() { |
77 importer_->Cancel(); | 77 importer_->Cancel(); |
78 importer_ = NULL; | 78 importer_ = NULL; |
79 bridge_ = NULL; | 79 bridge_ = NULL; |
80 import_thread_.reset(); | 80 import_thread_.reset(); |
81 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 81 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
82 } | 82 } |
83 | 83 |
84 // static | 84 // static |
85 bool ProfileImportHandler::Send(IPC::Message* message) { | 85 bool ProfileImportHandler::Send(IPC::Message* message) { |
86 return content::UtilityThread::Get()->Send(message); | 86 return content::UtilityThread::Get()->Send(message); |
87 } | 87 } |
88 | 88 |
89 } // namespace chrome | 89 } // namespace chrome |
OLD | NEW |