Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc

Issue 2960433002: SavedFilesServiceInterface in //extensions (Closed)
Patch Set: rebase Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extensions/api/developer_private/show_permissions_dialo g_helper.h" 5 #include "chrome/browser/extensions/api/developer_private/show_permissions_dialo g_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "apps/saved_files_service.h" 9 #include "apps/saved_files_service.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "chrome/browser/apps/app_load_service.h" 11 #include "chrome/browser/apps/app_load_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/apps/app_info_dialog.h" 13 #include "chrome/browser/ui/apps/app_info_dialog.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "extensions/browser/api/device_permissions_manager.h" 15 #include "extensions/browser/api/device_permissions_manager.h"
16 #include "extensions/browser/api/file_system/saved_file_entry.h"
16 #include "extensions/browser/extension_registry.h" 17 #include "extensions/browser/extension_registry.h"
17 #include "extensions/common/extension.h" 18 #include "extensions/common/extension.h"
18 #include "extensions/common/permissions/permissions_data.h" 19 #include "extensions/common/permissions/permissions_data.h"
19 20
20 namespace extensions { 21 namespace extensions {
21 22
22 ShowPermissionsDialogHelper::ShowPermissionsDialogHelper( 23 ShowPermissionsDialogHelper::ShowPermissionsDialogHelper(
23 Profile* profile, 24 Profile* profile,
24 const base::Closure& on_complete) 25 const base::Closure& on_complete)
25 : profile_(profile), 26 : profile_(profile),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 60 }
60 61
61 void ShowPermissionsDialogHelper::ShowPermissionsDialog( 62 void ShowPermissionsDialogHelper::ShowPermissionsDialog(
62 content::WebContents* web_contents, 63 content::WebContents* web_contents,
63 const Extension* extension) { 64 const Extension* extension) {
64 extension_id_ = extension->id(); 65 extension_id_ = extension->id();
65 prompt_.reset(new ExtensionInstallPrompt(web_contents)); 66 prompt_.reset(new ExtensionInstallPrompt(web_contents));
66 std::vector<base::FilePath> retained_file_paths; 67 std::vector<base::FilePath> retained_file_paths;
67 if (extension->permissions_data()->HasAPIPermission( 68 if (extension->permissions_data()->HasAPIPermission(
68 APIPermission::kFileSystem)) { 69 APIPermission::kFileSystem)) {
69 std::vector<apps::SavedFileEntry> retained_file_entries = 70 std::vector<SavedFileEntry> retained_file_entries =
70 apps::SavedFilesService::Get(profile_) 71 apps::SavedFilesService::Get(profile_)->GetAllFileEntries(
71 ->GetAllFileEntries(extension_id_); 72 extension_id_);
72 for (const apps::SavedFileEntry& entry : retained_file_entries) 73 for (const SavedFileEntry& entry : retained_file_entries)
73 retained_file_paths.push_back(entry.path); 74 retained_file_paths.push_back(entry.path);
74 } 75 }
75 std::vector<base::string16> retained_device_messages; 76 std::vector<base::string16> retained_device_messages;
76 if (extension->permissions_data()->HasAPIPermission(APIPermission::kUsb)) { 77 if (extension->permissions_data()->HasAPIPermission(APIPermission::kUsb)) {
77 retained_device_messages = 78 retained_device_messages =
78 DevicePermissionsManager::Get(profile_) 79 DevicePermissionsManager::Get(profile_)
79 ->GetPermissionMessageStrings(extension_id_); 80 ->GetPermissionMessageStrings(extension_id_);
80 } 81 }
81 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt( 82 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt(
82 new ExtensionInstallPrompt::Prompt( 83 new ExtensionInstallPrompt::Prompt(
(...skipping 21 matching lines...) Expand all
104 apps::SavedFilesService::Get(profile_)->ClearQueue(extension); 105 apps::SavedFilesService::Get(profile_)->ClearQueue(extension);
105 apps::AppLoadService::Get(profile_) 106 apps::AppLoadService::Get(profile_)
106 ->RestartApplicationIfRunning(extension_id_); 107 ->RestartApplicationIfRunning(extension_id_);
107 } 108 }
108 109
109 on_complete_.Run(); 110 on_complete_.Run();
110 delete this; 111 delete this;
111 } 112 }
112 113
113 } // namespace extensions 114 } // namespace extensions
OLDNEW
« no previous file with comments | « apps/saved_files_service_unittest.cc ('k') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698