OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/apps/drive/drive_app_converter.h" | 5 #include "chrome/browser/apps/drive/drive_app_converter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback_helpers.h" | |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/extensions/crx_installer.h" | 14 #include "chrome/browser/extensions/crx_installer.h" |
14 #include "chrome/browser/extensions/install_tracker.h" | 15 #include "chrome/browser/extensions/install_tracker.h" |
15 #include "chrome/browser/image_decoder.h" | 16 #include "chrome/browser/image_decoder.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "extensions/browser/extension_system.h" | 19 #include "extensions/browser/extension_system.h" |
19 #include "extensions/common/constants.h" | 20 #include "extensions/common/constants.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 | 104 |
104 DriveAppConverter::~DriveAppConverter() { | 105 DriveAppConverter::~DriveAppConverter() { |
105 PostInstallCleanUp(); | 106 PostInstallCleanUp(); |
106 } | 107 } |
107 | 108 |
108 void DriveAppConverter::Start() { | 109 void DriveAppConverter::Start() { |
109 DCHECK(!IsStarted()); | 110 DCHECK(!IsStarted()); |
110 | 111 |
111 if (drive_app_info_.app_name.empty() || | 112 if (drive_app_info_.app_name.empty() || |
112 !drive_app_info_.create_url.is_valid()) { | 113 !drive_app_info_.create_url.is_valid()) { |
113 finished_callback_.Run(this, false); | 114 finished_callback_.Run(this, false); |
benwells
2015/04/27 22:22:10
Its also called here. Should this one be updated t
xiyuan
2015/04/27 22:54:14
Good catch. This should be updated too.
| |
114 return; | 115 return; |
115 } | 116 } |
116 | 117 |
117 web_app_.title = base::UTF8ToUTF16(drive_app_info_.app_name); | 118 web_app_.title = base::UTF8ToUTF16(drive_app_info_.app_name); |
118 web_app_.app_url = drive_app_info_.create_url; | 119 web_app_.app_url = drive_app_info_.create_url; |
119 | 120 |
120 const std::set<int> allowed_sizes(extension_misc::kExtensionIconSizes, | 121 const std::set<int> allowed_sizes(extension_misc::kExtensionIconSizes, |
121 extension_misc::kExtensionIconSizes + | 122 extension_misc::kExtensionIconSizes + |
122 extension_misc::kNumExtensionIconSizes); | 123 extension_misc::kNumExtensionIconSizes); |
123 std::set<int> pending_sizes; | 124 std::set<int> pending_sizes; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 bool success) { | 192 bool success) { |
192 if (!crx_installer_->extension() || | 193 if (!crx_installer_->extension() || |
193 crx_installer_->extension()->id() != extension_id) { | 194 crx_installer_->extension()->id() != extension_id) { |
194 return; | 195 return; |
195 } | 196 } |
196 | 197 |
197 extension_ = crx_installer_->extension(); | 198 extension_ = crx_installer_->extension(); |
198 is_new_install_ = success && crx_installer_->current_version().empty(); | 199 is_new_install_ = success && crx_installer_->current_version().empty(); |
199 PostInstallCleanUp(); | 200 PostInstallCleanUp(); |
200 | 201 |
201 finished_callback_.Run(this, success); | 202 base::ResetAndReturn(&finished_callback_).Run(this, success); |
202 // |finished_callback_| could delete this. | 203 // |finished_callback_| could delete this. |
203 } | 204 } |
OLD | NEW |