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_provider.h" | 5 #include "chrome/browser/apps/drive/drive_app_provider.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const bool is_existing_app_generated = | 75 const bool is_existing_app_generated = |
76 mapping_->IsChromeAppGenerated(existing_chrome_app_id); | 76 mapping_->IsChromeAppGenerated(existing_chrome_app_id); |
77 mapping_->Add(drive_app_id, new_chrome_app_id, is_new_app_generated); | 77 mapping_->Add(drive_app_id, new_chrome_app_id, is_new_app_generated); |
78 | 78 |
79 const Extension* existing_app = | 79 const Extension* existing_app = |
80 ExtensionRegistry::Get(profile_)->GetExtensionById( | 80 ExtensionRegistry::Get(profile_)->GetExtensionById( |
81 existing_chrome_app_id, ExtensionRegistry::EVERYTHING); | 81 existing_chrome_app_id, ExtensionRegistry::EVERYTHING); |
82 if (existing_app && is_existing_app_generated) { | 82 if (existing_app && is_existing_app_generated) { |
83 extensions::ExtensionSystem::Get(profile_) | 83 extensions::ExtensionSystem::Get(profile_) |
84 ->extension_service() | 84 ->extension_service() |
85 ->UninstallExtension(existing_chrome_app_id, false, NULL); | 85 ->UninstallExtension(existing_chrome_app_id, |
| 86 ExtensionService::UNINSTALL_REASON_SYNC, |
| 87 NULL); |
86 } | 88 } |
87 } | 89 } |
88 | 90 |
89 void DriveAppProvider::ProcessDeferredOnExtensionInstalled( | 91 void DriveAppProvider::ProcessDeferredOnExtensionInstalled( |
90 const std::string drive_app_id, | 92 const std::string drive_app_id, |
91 const std::string chrome_app_id) { | 93 const std::string chrome_app_id) { |
92 const Extension* app = ExtensionRegistry::Get(profile_)->GetExtensionById( | 94 const Extension* app = ExtensionRegistry::Get(profile_)->GetExtensionById( |
93 chrome_app_id, ExtensionRegistry::EVERYTHING); | 95 chrome_app_id, ExtensionRegistry::EVERYTHING); |
94 if (!app) | 96 if (!app) |
95 return; | 97 return; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return; | 186 return; |
185 | 187 |
186 const Extension* existing_app = | 188 const Extension* existing_app = |
187 ExtensionRegistry::Get(profile_) | 189 ExtensionRegistry::Get(profile_) |
188 ->GetExtensionById(chrome_app_id, ExtensionRegistry::EVERYTHING); | 190 ->GetExtensionById(chrome_app_id, ExtensionRegistry::EVERYTHING); |
189 if (!existing_app) | 191 if (!existing_app) |
190 return; | 192 return; |
191 | 193 |
192 extensions::ExtensionSystem::Get(profile_) | 194 extensions::ExtensionSystem::Get(profile_) |
193 ->extension_service() | 195 ->extension_service() |
194 ->UninstallExtension(chrome_app_id, false, NULL); | 196 ->UninstallExtension( |
| 197 chrome_app_id, ExtensionService::UNINSTALL_REASON_SYNC, NULL); |
195 } | 198 } |
196 | 199 |
197 void DriveAppProvider::OnDriveAppRegistryUpdated() { | 200 void DriveAppProvider::OnDriveAppRegistryUpdated() { |
198 service_bridge_->GetAppRegistry()->GetAppList(&drive_apps_); | 201 service_bridge_->GetAppRegistry()->GetAppList(&drive_apps_); |
199 | 202 |
200 IdSet current_ids; | 203 IdSet current_ids; |
201 for (size_t i = 0; i < drive_apps_.size(); ++i) | 204 for (size_t i = 0; i < drive_apps_.size(); ++i) |
202 current_ids.insert(drive_apps_[i].app_id); | 205 current_ids.insert(drive_apps_[i].app_id); |
203 | 206 |
204 const IdSet existing_ids = mapping_->GetDriveAppIds(); | 207 const IdSet existing_ids = mapping_->GetDriveAppIds(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 void DriveAppProvider::OnExtensionUninstalled( | 257 void DriveAppProvider::OnExtensionUninstalled( |
255 content::BrowserContext* browser_context, | 258 content::BrowserContext* browser_context, |
256 const Extension* extension) { | 259 const Extension* extension) { |
257 std::string drive_app_id = mapping_->GetDriveApp(extension->id()); | 260 std::string drive_app_id = mapping_->GetDriveApp(extension->id()); |
258 if (drive_app_id.empty()) | 261 if (drive_app_id.empty()) |
259 return; | 262 return; |
260 | 263 |
261 service_bridge_->GetAppRegistry()->UninstallApp( | 264 service_bridge_->GetAppRegistry()->UninstallApp( |
262 drive_app_id, base::Bind(&IgnoreUninstallResult)); | 265 drive_app_id, base::Bind(&IgnoreUninstallResult)); |
263 } | 266 } |
OLD | NEW |