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

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

Issue 118993002: drive: Move FileSystem::LoadDirectoryIfNeeded to ChangeListLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix Created 7 years 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
« no previous file with comments | « chrome/browser/resources/chromeos/drive_internals.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // Callback for DebugInfoCollector::GetMetadata for delta update. 283 // Callback for DebugInfoCollector::GetMetadata for delta update.
284 void OnGetFilesystemMetadataForDeltaUpdate( 284 void OnGetFilesystemMetadataForDeltaUpdate(
285 const drive::FileSystemMetadata& metadata); 285 const drive::FileSystemMetadata& metadata);
286 286
287 // Called when the page requests periodic update. 287 // Called when the page requests periodic update.
288 void OnPeriodicUpdate(const base::ListValue* args); 288 void OnPeriodicUpdate(const base::ListValue* args);
289 289
290 // Called when the corresponding button on the page is pressed. 290 // Called when the corresponding button on the page is pressed.
291 void ClearAccessToken(const base::ListValue* args); 291 void ClearAccessToken(const base::ListValue* args);
292 void ClearRefreshToken(const base::ListValue* args); 292 void ClearRefreshToken(const base::ListValue* args);
293 void ReloadDriveFileSystem(const base::ListValue* args); 293 void ResetDriveFileSystem(const base::ListValue* args);
294 void ListFileEntries(const base::ListValue* args); 294 void ListFileEntries(const base::ListValue* args);
295 295
296 // Called after file system reload for ReloadDriveFileSystem is done. 296 // Called after file system reset for ResetDriveFileSystem is done.
297 void ReloadFinished(bool success); 297 void ResetFinished(bool success);
298 298
299 // The last event sent to the JavaScript side. 299 // The last event sent to the JavaScript side.
300 int last_sent_event_id_; 300 int last_sent_event_id_;
301 301
302 base::WeakPtrFactory<DriveInternalsWebUIHandler> weak_ptr_factory_; 302 base::WeakPtrFactory<DriveInternalsWebUIHandler> weak_ptr_factory_;
303 DISALLOW_COPY_AND_ASSIGN(DriveInternalsWebUIHandler); 303 DISALLOW_COPY_AND_ASSIGN(DriveInternalsWebUIHandler);
304 }; 304 };
305 305
306 void DriveInternalsWebUIHandler::OnGetAboutResource( 306 void DriveInternalsWebUIHandler::OnGetAboutResource(
307 google_apis::GDataErrorCode status, 307 google_apis::GDataErrorCode status,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 weak_ptr_factory_.GetWeakPtr())); 368 weak_ptr_factory_.GetWeakPtr()));
369 web_ui()->RegisterMessageCallback( 369 web_ui()->RegisterMessageCallback(
370 "clearAccessToken", 370 "clearAccessToken",
371 base::Bind(&DriveInternalsWebUIHandler::ClearAccessToken, 371 base::Bind(&DriveInternalsWebUIHandler::ClearAccessToken,
372 weak_ptr_factory_.GetWeakPtr())); 372 weak_ptr_factory_.GetWeakPtr()));
373 web_ui()->RegisterMessageCallback( 373 web_ui()->RegisterMessageCallback(
374 "clearRefreshToken", 374 "clearRefreshToken",
375 base::Bind(&DriveInternalsWebUIHandler::ClearRefreshToken, 375 base::Bind(&DriveInternalsWebUIHandler::ClearRefreshToken,
376 weak_ptr_factory_.GetWeakPtr())); 376 weak_ptr_factory_.GetWeakPtr()));
377 web_ui()->RegisterMessageCallback( 377 web_ui()->RegisterMessageCallback(
378 "reloadDriveFileSystem", 378 "resetDriveFileSystem",
379 base::Bind(&DriveInternalsWebUIHandler::ReloadDriveFileSystem, 379 base::Bind(&DriveInternalsWebUIHandler::ResetDriveFileSystem,
380 weak_ptr_factory_.GetWeakPtr())); 380 weak_ptr_factory_.GetWeakPtr()));
381 web_ui()->RegisterMessageCallback( 381 web_ui()->RegisterMessageCallback(
382 "listFileEntries", 382 "listFileEntries",
383 base::Bind(&DriveInternalsWebUIHandler::ListFileEntries, 383 base::Bind(&DriveInternalsWebUIHandler::ListFileEntries,
384 weak_ptr_factory_.GetWeakPtr())); 384 weak_ptr_factory_.GetWeakPtr()));
385 } 385 }
386 386
387 drive::DriveIntegrationService* 387 drive::DriveIntegrationService*
388 DriveInternalsWebUIHandler::GetIntegrationService() { 388 DriveInternalsWebUIHandler::GetIntegrationService() {
389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 581
582 void DriveInternalsWebUIHandler::ClearRefreshToken( 582 void DriveInternalsWebUIHandler::ClearRefreshToken(
583 const base::ListValue* args) { 583 const base::ListValue* args) {
584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
585 585
586 drive::DriveServiceInterface* drive_service = GetDriveService(); 586 drive::DriveServiceInterface* drive_service = GetDriveService();
587 if (drive_service) 587 if (drive_service)
588 drive_service->ClearRefreshToken(); 588 drive_service->ClearRefreshToken();
589 } 589 }
590 590
591 void DriveInternalsWebUIHandler::ReloadDriveFileSystem( 591 void DriveInternalsWebUIHandler::ResetDriveFileSystem(
592 const base::ListValue* args) { 592 const base::ListValue* args) {
593 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 593 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
594 594
595 drive::DriveIntegrationService* integration_service = 595 drive::DriveIntegrationService* integration_service =
596 GetIntegrationService(); 596 GetIntegrationService();
597 if (integration_service) { 597 if (integration_service) {
598 integration_service->ClearCacheAndRemountFileSystem( 598 integration_service->ClearCacheAndRemountFileSystem(
599 base::Bind(&DriveInternalsWebUIHandler::ReloadFinished, 599 base::Bind(&DriveInternalsWebUIHandler::ResetFinished,
600 weak_ptr_factory_.GetWeakPtr())); 600 weak_ptr_factory_.GetWeakPtr()));
601 } 601 }
602 } 602 }
603 603
604 void DriveInternalsWebUIHandler::ReloadFinished(bool success) { 604 void DriveInternalsWebUIHandler::ResetFinished(bool success) {
605 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 605 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
606 606
607 web_ui()->CallJavascriptFunction("updateReloadStatus", 607 web_ui()->CallJavascriptFunction("updateResetStatus",
608 base::FundamentalValue(success)); 608 base::FundamentalValue(success));
609 } 609 }
610 610
611 void DriveInternalsWebUIHandler::ListFileEntries(const base::ListValue* args) { 611 void DriveInternalsWebUIHandler::ListFileEntries(const base::ListValue* args) {
612 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 612 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
613 613
614 UpdateFileSystemContentsSection(); 614 UpdateFileSystemContentsSection();
615 } 615 }
616 616
617 void DriveInternalsWebUIHandler::UpdateDeltaUpdateStatusSection( 617 void DriveInternalsWebUIHandler::UpdateDeltaUpdateStatusSection(
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); 886 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost);
887 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); 887 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS);
888 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); 888 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS);
889 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); 889 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML);
890 890
891 Profile* profile = Profile::FromWebUI(web_ui); 891 Profile* profile = Profile::FromWebUI(web_ui);
892 content::WebUIDataSource::Add(profile, source); 892 content::WebUIDataSource::Add(profile, source);
893 } 893 }
894 894
895 } // namespace chromeos 895 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/drive_internals.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698