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

Side by Side Diff: chrome/browser/ui/webui/chromeos/drive_internals_ui.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 (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/browser/ui/webui/chromeos/drive_internals_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 void UpdateEventLogSection(); 253 void UpdateEventLogSection();
254 void UpdatePathConfigurationsSection(); 254 void UpdatePathConfigurationsSection();
255 255
256 // Called when GetGCacheContents() is complete. 256 // Called when GetGCacheContents() is complete.
257 void OnGetGCacheContents(base::ListValue* gcache_contents, 257 void OnGetGCacheContents(base::ListValue* gcache_contents,
258 base::DictionaryValue* cache_summary); 258 base::DictionaryValue* cache_summary);
259 259
260 // Called when GetResourceEntryByPath() is complete. 260 // Called when GetResourceEntryByPath() is complete.
261 void OnGetResourceEntryByPath(const base::FilePath& path, 261 void OnGetResourceEntryByPath(const base::FilePath& path,
262 drive::FileError error, 262 drive::FileError error,
263 scoped_ptr<drive::ResourceEntry> entry); 263 std::unique_ptr<drive::ResourceEntry> entry);
264 264
265 // Called when ReadDirectoryByPath() is complete. 265 // Called when ReadDirectoryByPath() is complete.
266 void OnReadDirectoryByPath(const base::FilePath& parent_path, 266 void OnReadDirectoryByPath(
267 drive::FileError error, 267 const base::FilePath& parent_path,
268 scoped_ptr<drive::ResourceEntryVector> entries); 268 drive::FileError error,
269 std::unique_ptr<drive::ResourceEntryVector> entries);
269 270
270 // Called as the iterator for DebugInfoCollector::IterateFileCache(). 271 // Called as the iterator for DebugInfoCollector::IterateFileCache().
271 void UpdateCacheEntry(const std::string& local_id, 272 void UpdateCacheEntry(const std::string& local_id,
272 const drive::FileCacheEntry& cache_entry); 273 const drive::FileCacheEntry& cache_entry);
273 274
274 // Called when GetFreeDiskSpace() is complete. 275 // Called when GetFreeDiskSpace() is complete.
275 void OnGetFreeDiskSpace(base::DictionaryValue* local_storage_summary); 276 void OnGetFreeDiskSpace(base::DictionaryValue* local_storage_summary);
276 277
277 // Called when GetAboutResource() call to DriveService is complete. 278 // Called when GetAboutResource() call to DriveService is complete.
278 void OnGetAboutResource( 279 void OnGetAboutResource(
279 google_apis::DriveApiErrorCode status, 280 google_apis::DriveApiErrorCode status,
280 scoped_ptr<google_apis::AboutResource> about_resource); 281 std::unique_ptr<google_apis::AboutResource> about_resource);
281 282
282 // Called when GetAppList() call to DriveService is complete. 283 // Called when GetAppList() call to DriveService is complete.
283 void OnGetAppList( 284 void OnGetAppList(google_apis::DriveApiErrorCode status,
284 google_apis::DriveApiErrorCode status, 285 std::unique_ptr<google_apis::AppList> app_list);
285 scoped_ptr<google_apis::AppList> app_list);
286 286
287 // Callback for DebugInfoCollector::GetMetadata for local update. 287 // Callback for DebugInfoCollector::GetMetadata for local update.
288 void OnGetFilesystemMetadataForLocal( 288 void OnGetFilesystemMetadataForLocal(
289 const drive::FileSystemMetadata& metadata); 289 const drive::FileSystemMetadata& metadata);
290 290
291 // Callback for DebugInfoCollector::GetMetadata for delta update. 291 // Callback for DebugInfoCollector::GetMetadata for delta update.
292 void OnGetFilesystemMetadataForDeltaUpdate( 292 void OnGetFilesystemMetadataForDeltaUpdate(
293 const drive::FileSystemMetadata& metadata); 293 const drive::FileSystemMetadata& metadata);
294 294
295 // Called when the page requests periodic update. 295 // Called when the page requests periodic update.
(...skipping 10 matching lines...) Expand all
306 306
307 // The last event sent to the JavaScript side. 307 // The last event sent to the JavaScript side.
308 int last_sent_event_id_; 308 int last_sent_event_id_;
309 309
310 base::WeakPtrFactory<DriveInternalsWebUIHandler> weak_ptr_factory_; 310 base::WeakPtrFactory<DriveInternalsWebUIHandler> weak_ptr_factory_;
311 DISALLOW_COPY_AND_ASSIGN(DriveInternalsWebUIHandler); 311 DISALLOW_COPY_AND_ASSIGN(DriveInternalsWebUIHandler);
312 }; 312 };
313 313
314 void DriveInternalsWebUIHandler::OnGetAboutResource( 314 void DriveInternalsWebUIHandler::OnGetAboutResource(
315 google_apis::DriveApiErrorCode status, 315 google_apis::DriveApiErrorCode status,
316 scoped_ptr<google_apis::AboutResource> parsed_about_resource) { 316 std::unique_ptr<google_apis::AboutResource> parsed_about_resource) {
317 DCHECK_CURRENTLY_ON(BrowserThread::UI); 317 DCHECK_CURRENTLY_ON(BrowserThread::UI);
318 318
319 if (status != google_apis::HTTP_SUCCESS) { 319 if (status != google_apis::HTTP_SUCCESS) {
320 LOG(ERROR) << "Failed to get about resource"; 320 LOG(ERROR) << "Failed to get about resource";
321 return; 321 return;
322 } 322 }
323 DCHECK(parsed_about_resource); 323 DCHECK(parsed_about_resource);
324 324
325 base::DictionaryValue about_resource; 325 base::DictionaryValue about_resource;
326 about_resource.SetDouble("account-quota-total", 326 about_resource.SetDouble("account-quota-total",
327 parsed_about_resource->quota_bytes_total()); 327 parsed_about_resource->quota_bytes_total());
328 about_resource.SetDouble("account-quota-used", 328 about_resource.SetDouble("account-quota-used",
329 parsed_about_resource->quota_bytes_used_aggregate()); 329 parsed_about_resource->quota_bytes_used_aggregate());
330 about_resource.SetDouble("account-largest-changestamp-remote", 330 about_resource.SetDouble("account-largest-changestamp-remote",
331 parsed_about_resource->largest_change_id()); 331 parsed_about_resource->largest_change_id());
332 about_resource.SetString("root-resource-id", 332 about_resource.SetString("root-resource-id",
333 parsed_about_resource->root_folder_id()); 333 parsed_about_resource->root_folder_id());
334 334
335 web_ui()->CallJavascriptFunction("updateAboutResource", about_resource); 335 web_ui()->CallJavascriptFunction("updateAboutResource", about_resource);
336 } 336 }
337 337
338 void DriveInternalsWebUIHandler::OnGetAppList( 338 void DriveInternalsWebUIHandler::OnGetAppList(
339 google_apis::DriveApiErrorCode status, 339 google_apis::DriveApiErrorCode status,
340 scoped_ptr<google_apis::AppList> parsed_app_list) { 340 std::unique_ptr<google_apis::AppList> parsed_app_list) {
341 DCHECK_CURRENTLY_ON(BrowserThread::UI); 341 DCHECK_CURRENTLY_ON(BrowserThread::UI);
342 342
343 if (status != google_apis::HTTP_SUCCESS) { 343 if (status != google_apis::HTTP_SUCCESS) {
344 LOG(ERROR) << "Failed to get app list"; 344 LOG(ERROR) << "Failed to get app list";
345 return; 345 return;
346 } 346 }
347 DCHECK(parsed_app_list); 347 DCHECK(parsed_app_list);
348 348
349 base::DictionaryValue app_list; 349 base::DictionaryValue app_list;
350 app_list.SetString("etag", parsed_app_list->etag()); 350 app_list.SetString("etag", parsed_app_list->etag());
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 DCHECK(gcache_summary); 797 DCHECK(gcache_summary);
798 798
799 web_ui()->CallJavascriptFunction("updateGCacheContents", 799 web_ui()->CallJavascriptFunction("updateGCacheContents",
800 *gcache_contents, 800 *gcache_contents,
801 *gcache_summary); 801 *gcache_summary);
802 } 802 }
803 803
804 void DriveInternalsWebUIHandler::OnGetResourceEntryByPath( 804 void DriveInternalsWebUIHandler::OnGetResourceEntryByPath(
805 const base::FilePath& path, 805 const base::FilePath& path,
806 drive::FileError error, 806 drive::FileError error,
807 scoped_ptr<drive::ResourceEntry> entry) { 807 std::unique_ptr<drive::ResourceEntry> entry) {
808 DCHECK_CURRENTLY_ON(BrowserThread::UI); 808 DCHECK_CURRENTLY_ON(BrowserThread::UI);
809 809
810 if (error == drive::FILE_ERROR_OK) { 810 if (error == drive::FILE_ERROR_OK) {
811 DCHECK(entry.get()); 811 DCHECK(entry.get());
812 const base::StringValue value(FormatEntry(path, *entry) + "\n"); 812 const base::StringValue value(FormatEntry(path, *entry) + "\n");
813 web_ui()->CallJavascriptFunction("updateFileSystemContents", value); 813 web_ui()->CallJavascriptFunction("updateFileSystemContents", value);
814 } 814 }
815 } 815 }
816 816
817 void DriveInternalsWebUIHandler::OnReadDirectoryByPath( 817 void DriveInternalsWebUIHandler::OnReadDirectoryByPath(
818 const base::FilePath& parent_path, 818 const base::FilePath& parent_path,
819 drive::FileError error, 819 drive::FileError error,
820 scoped_ptr<drive::ResourceEntryVector> entries) { 820 std::unique_ptr<drive::ResourceEntryVector> entries) {
821 DCHECK_CURRENTLY_ON(BrowserThread::UI); 821 DCHECK_CURRENTLY_ON(BrowserThread::UI);
822 822
823 if (error == drive::FILE_ERROR_OK) { 823 if (error == drive::FILE_ERROR_OK) {
824 DCHECK(entries.get()); 824 DCHECK(entries.get());
825 825
826 drive::DebugInfoCollector* debug_info_collector = GetDebugInfoCollector(); 826 drive::DebugInfoCollector* debug_info_collector = GetDebugInfoCollector();
827 std::string file_system_as_text; 827 std::string file_system_as_text;
828 for (size_t i = 0; i < entries->size(); ++i) { 828 for (size_t i = 0; i < entries->size(); ++i) {
829 const drive::ResourceEntry& entry = (*entries)[i]; 829 const drive::ResourceEntry& entry = (*entries)[i];
830 const base::FilePath current_path = parent_path.Append( 830 const base::FilePath current_path = parent_path.Append(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); 897 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost);
898 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); 898 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS);
899 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); 899 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS);
900 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); 900 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML);
901 901
902 Profile* profile = Profile::FromWebUI(web_ui); 902 Profile* profile = Profile::FromWebUI(web_ui);
903 content::WebUIDataSource::Add(profile, source); 903 content::WebUIDataSource::Add(profile, source);
904 } 904 }
905 905
906 } // namespace chromeos 906 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698