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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc

Issue 23715003: Files.app: Rename the FileBrowserPrivateAPI's functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comments. Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/extensions/file_manager/private_api_misc.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 10 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
11 #include "chrome/browser/chromeos/drive/logging.h" 11 #include "chrome/browser/chromeos/drive/logging.h"
12 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" 12 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
13 #include "chrome/browser/chromeos/settings/cros_settings.h" 13 #include "chrome/browser/chromeos/settings/cros_settings.h"
14 #include "chrome/browser/lifetime/application_lifetime.h" 14 #include "chrome/browser/lifetime/application_lifetime.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/render_view_host.h" 17 #include "content/public/browser/render_view_host.h"
18 #include "content/public/common/page_zoom.h" 18 #include "content/public/common/page_zoom.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace extensions { 21 namespace extensions {
22 22
23 LogoutUserFunction::LogoutUserFunction() { 23 FileBrowserPrivateLogoutUserFunction::FileBrowserPrivateLogoutUserFunction() {
24 } 24 }
25 25
26 LogoutUserFunction::~LogoutUserFunction() { 26 FileBrowserPrivateLogoutUserFunction::~FileBrowserPrivateLogoutUserFunction() {
27 } 27 }
28 28
29 bool LogoutUserFunction::RunImpl() { 29 bool FileBrowserPrivateLogoutUserFunction::RunImpl() {
30 chrome::AttemptUserExit(); 30 chrome::AttemptUserExit();
31 return true; 31 return true;
32 } 32 }
33 33
34 GetPreferencesFunction::GetPreferencesFunction() { 34 FileBrowserPrivateGetPreferencesFunction::
35 FileBrowserPrivateGetPreferencesFunction() {
35 } 36 }
36 37
37 GetPreferencesFunction::~GetPreferencesFunction() { 38 FileBrowserPrivateGetPreferencesFunction::
39 ~FileBrowserPrivateGetPreferencesFunction() {
38 } 40 }
39 41
40 bool GetPreferencesFunction::RunImpl() { 42 bool FileBrowserPrivateGetPreferencesFunction::RunImpl() {
41 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 43 scoped_ptr<DictionaryValue> value(new DictionaryValue());
42 44
43 const PrefService* service = profile_->GetPrefs(); 45 const PrefService* service = profile_->GetPrefs();
44 46
45 value->SetBoolean("driveEnabled", 47 value->SetBoolean("driveEnabled",
46 drive::util::IsDriveEnabledForProfile(profile_)); 48 drive::util::IsDriveEnabledForProfile(profile_));
47 49
48 value->SetBoolean("cellularDisabled", 50 value->SetBoolean("cellularDisabled",
49 service->GetBoolean(prefs::kDisableDriveOverCellular)); 51 service->GetBoolean(prefs::kDisableDriveOverCellular));
50 52
(...skipping 11 matching lines...) Expand all
62 } 64 }
63 value->SetBoolean("allowRedeemOffers", allow); 65 value->SetBoolean("allowRedeemOffers", allow);
64 } 66 }
65 67
66 SetResult(value.release()); 68 SetResult(value.release());
67 69
68 drive::util::Log(logging::LOG_INFO, "%s succeeded.", name().c_str()); 70 drive::util::Log(logging::LOG_INFO, "%s succeeded.", name().c_str());
69 return true; 71 return true;
70 } 72 }
71 73
72 SetPreferencesFunction::SetPreferencesFunction() { 74 FileBrowserPrivateSetPreferencesFunction::
75 FileBrowserPrivateSetPreferencesFunction() {
73 } 76 }
74 77
75 SetPreferencesFunction::~SetPreferencesFunction() { 78 FileBrowserPrivateSetPreferencesFunction::
79 ~FileBrowserPrivateSetPreferencesFunction() {
76 } 80 }
77 81
78 bool SetPreferencesFunction::RunImpl() { 82 bool FileBrowserPrivateSetPreferencesFunction::RunImpl() {
79 base::DictionaryValue* value = NULL; 83 base::DictionaryValue* value = NULL;
80 84
81 if (!args_->GetDictionary(0, &value) || !value) 85 if (!args_->GetDictionary(0, &value) || !value)
82 return false; 86 return false;
83 87
84 PrefService* service = profile_->GetPrefs(); 88 PrefService* service = profile_->GetPrefs();
85 89
86 bool tmp; 90 bool tmp;
87 91
88 if (value->GetBoolean("cellularDisabled", &tmp)) 92 if (value->GetBoolean("cellularDisabled", &tmp))
89 service->SetBoolean(prefs::kDisableDriveOverCellular, tmp); 93 service->SetBoolean(prefs::kDisableDriveOverCellular, tmp);
90 94
91 if (value->GetBoolean("hostedFilesDisabled", &tmp)) 95 if (value->GetBoolean("hostedFilesDisabled", &tmp))
92 service->SetBoolean(prefs::kDisableDriveHostedFiles, tmp); 96 service->SetBoolean(prefs::kDisableDriveHostedFiles, tmp);
93 97
94 drive::util::Log(logging::LOG_INFO, "%s succeeded.", name().c_str()); 98 drive::util::Log(logging::LOG_INFO, "%s succeeded.", name().c_str());
95 return true; 99 return true;
96 } 100 }
97 101
98 ZipSelectionFunction::ZipSelectionFunction() { 102 FileBrowserPrivateZipSelectionFunction::
103 FileBrowserPrivateZipSelectionFunction() {
99 } 104 }
100 105
101 ZipSelectionFunction::~ZipSelectionFunction() { 106 FileBrowserPrivateZipSelectionFunction::
107 ~FileBrowserPrivateZipSelectionFunction() {
102 } 108 }
103 109
104 bool ZipSelectionFunction::RunImpl() { 110 bool FileBrowserPrivateZipSelectionFunction::RunImpl() {
105 if (args_->GetSize() < 3) { 111 if (args_->GetSize() < 3) {
106 return false; 112 return false;
107 } 113 }
108 114
109 // First param is the source directory URL. 115 // First param is the source directory URL.
110 std::string dir_url; 116 std::string dir_url;
111 if (!args_->GetString(0, &dir_url) || dir_url.empty()) 117 if (!args_->GetString(0, &dir_url) || dir_url.empty())
112 return false; 118 return false;
113 119
114 base::FilePath src_dir = file_manager::util::GetLocalPathFromURL( 120 base::FilePath src_dir = file_manager::util::GetLocalPathFromURL(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 src_relative_paths, 166 src_relative_paths,
161 dest_file); 167 dest_file);
162 168
163 // Keep the refcount until the zipping is complete on utility process. 169 // Keep the refcount until the zipping is complete on utility process.
164 AddRef(); 170 AddRef();
165 171
166 zip_file_creator_->Start(); 172 zip_file_creator_->Start();
167 return true; 173 return true;
168 } 174 }
169 175
170 void ZipSelectionFunction::OnZipDone(bool success) { 176 void FileBrowserPrivateZipSelectionFunction::OnZipDone(bool success) {
171 SetResult(new base::FundamentalValue(success)); 177 SetResult(new base::FundamentalValue(success));
172 SendResponse(true); 178 SendResponse(true);
173 Release(); 179 Release();
174 } 180 }
175 181
176 ZoomFunction::ZoomFunction() { 182 FileBrowserPrivateZoomFunction::FileBrowserPrivateZoomFunction() {
177 } 183 }
178 184
179 ZoomFunction::~ZoomFunction() { 185 FileBrowserPrivateZoomFunction::~FileBrowserPrivateZoomFunction() {
180 } 186 }
181 187
182 bool ZoomFunction::RunImpl() { 188 bool FileBrowserPrivateZoomFunction::RunImpl() {
183 content::RenderViewHost* const view_host = render_view_host(); 189 content::RenderViewHost* const view_host = render_view_host();
184 std::string operation; 190 std::string operation;
185 args_->GetString(0, &operation); 191 args_->GetString(0, &operation);
186 content::PageZoom zoom_type; 192 content::PageZoom zoom_type;
187 if (operation == "in") { 193 if (operation == "in") {
188 zoom_type = content::PAGE_ZOOM_IN; 194 zoom_type = content::PAGE_ZOOM_IN;
189 } else if (operation == "out") { 195 } else if (operation == "out") {
190 zoom_type = content::PAGE_ZOOM_OUT; 196 zoom_type = content::PAGE_ZOOM_OUT;
191 } else if (operation == "reset") { 197 } else if (operation == "reset") {
192 zoom_type = content::PAGE_ZOOM_RESET; 198 zoom_type = content::PAGE_ZOOM_RESET;
193 } else { 199 } else {
194 NOTREACHED(); 200 NOTREACHED();
195 return false; 201 return false;
196 } 202 }
197 view_host->Zoom(zoom_type); 203 view_host->Zoom(zoom_type);
198 return true; 204 return true;
199 } 205 }
200 206
201 } // namespace extensions 207 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698