OLD | NEW |
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/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 weak_ptr_factory_.GetWeakPtr())); | 472 weak_ptr_factory_.GetWeakPtr())); |
473 } | 473 } |
474 | 474 |
475 void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal( | 475 void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal( |
476 const drive::DriveFileSystemMetadata& metadata) { | 476 const drive::DriveFileSystemMetadata& metadata) { |
477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
478 | 478 |
479 base::DictionaryValue local_metadata; | 479 base::DictionaryValue local_metadata; |
480 local_metadata.SetDouble("account-largest-changestamp-local", | 480 local_metadata.SetDouble("account-largest-changestamp-local", |
481 metadata.largest_changestamp); | 481 metadata.largest_changestamp); |
482 local_metadata.SetBoolean("account-metadata-loaded", metadata.loaded); | |
483 local_metadata.SetBoolean("account-metadata-refreshing", metadata.refreshing); | 482 local_metadata.SetBoolean("account-metadata-refreshing", metadata.refreshing); |
484 web_ui()->CallJavascriptFunction("updateLocalMetadata", local_metadata); | 483 web_ui()->CallJavascriptFunction("updateLocalMetadata", local_metadata); |
485 } | 484 } |
486 | 485 |
487 void DriveInternalsWebUIHandler::ClearAccessToken(const base::ListValue* args) { | 486 void DriveInternalsWebUIHandler::ClearAccessToken(const base::ListValue* args) { |
488 drive::DriveSystemService* const system_service = GetSystemService(); | 487 drive::DriveSystemService* const system_service = GetSystemService(); |
489 if (!system_service) | 488 if (!system_service) |
490 return; | 489 return; |
491 system_service->drive_service()->ClearAccessToken(); | 490 system_service->drive_service()->ClearAccessToken(); |
492 } | 491 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 BrowserThread::PostBlockingPoolTaskAndReply( | 573 BrowserThread::PostBlockingPoolTaskAndReply( |
575 FROM_HERE, | 574 FROM_HERE, |
576 base::Bind(&GetGCacheContents, | 575 base::Bind(&GetGCacheContents, |
577 root_path, | 576 root_path, |
578 gcache_contents, | 577 gcache_contents, |
579 gcache_summary), | 578 gcache_summary), |
580 base::Bind(&DriveInternalsWebUIHandler::OnGetGCacheContents, | 579 base::Bind(&DriveInternalsWebUIHandler::OnGetGCacheContents, |
581 weak_ptr_factory_.GetWeakPtr(), | 580 weak_ptr_factory_.GetWeakPtr(), |
582 base::Owned(gcache_contents), | 581 base::Owned(gcache_contents), |
583 base::Owned(gcache_summary))); | 582 base::Owned(gcache_summary))); |
584 | |
585 } | 583 } |
586 | 584 |
587 void DriveInternalsWebUIHandler::UpdateFileSystemContentsSection() { | 585 void DriveInternalsWebUIHandler::UpdateFileSystemContentsSection() { |
588 drive::DriveSystemService* const system_service = GetSystemService(); | 586 drive::DriveSystemService* const system_service = GetSystemService(); |
589 if (!system_service) | 587 if (!system_service) |
590 return; | 588 return; |
591 // Start updating the file system tree section, if we have access token. | 589 // Start updating the file system tree section, if we have access token. |
592 if (!system_service->drive_service()->HasAccessToken()) | 590 if (!system_service->drive_service()->HasAccessToken()) |
593 return; | 591 return; |
594 | 592 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); | 756 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); |
759 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); | 757 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); |
760 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); | 758 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); |
761 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); | 759 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); |
762 | 760 |
763 Profile* profile = Profile::FromWebUI(web_ui); | 761 Profile* profile = Profile::FromWebUI(web_ui); |
764 content::WebUIDataSource::Add(profile, source); | 762 content::WebUIDataSource::Add(profile, source); |
765 } | 763 } |
766 | 764 |
767 } // namespace chromeos | 765 } // namespace chromeos |
OLD | NEW |