| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 google_apis::GDataErrorCode status, | 246 google_apis::GDataErrorCode status, |
| 247 scoped_ptr<google_apis::AboutResource> about_resource); | 247 scoped_ptr<google_apis::AboutResource> about_resource); |
| 248 | 248 |
| 249 // Called when GetAppList() call to DriveService is complete. | 249 // Called when GetAppList() call to DriveService is complete. |
| 250 void OnGetAppList( | 250 void OnGetAppList( |
| 251 google_apis::GDataErrorCode status, | 251 google_apis::GDataErrorCode status, |
| 252 scoped_ptr<google_apis::AppList> app_list); | 252 scoped_ptr<google_apis::AppList> app_list); |
| 253 | 253 |
| 254 // Callback for DriveFilesystem::GetMetadata for local update. | 254 // Callback for DriveFilesystem::GetMetadata for local update. |
| 255 void OnGetFilesystemMetadataForLocal( | 255 void OnGetFilesystemMetadataForLocal( |
| 256 const drive::DriveFileSystemMetadata& metadata); | 256 const drive::FileSystemMetadata& metadata); |
| 257 | 257 |
| 258 // Callback for DriveFilesystem::GetMetadata for local update. | 258 // Callback for DriveFilesystem::GetMetadata for local update. |
| 259 void OnGetFilesystemMetadataForDeltaUpdate( | 259 void OnGetFilesystemMetadataForDeltaUpdate( |
| 260 const drive::DriveFileSystemMetadata& metadata); | 260 const drive::FileSystemMetadata& metadata); |
| 261 | 261 |
| 262 // Called when the page requests periodic update. | 262 // Called when the page requests periodic update. |
| 263 void OnPeriodicUpdate(const base::ListValue* args); | 263 void OnPeriodicUpdate(const base::ListValue* args); |
| 264 | 264 |
| 265 void ClearAccessToken(const base::ListValue* args); | 265 void ClearAccessToken(const base::ListValue* args); |
| 266 void ClearRefreshToken(const base::ListValue* args); | 266 void ClearRefreshToken(const base::ListValue* args); |
| 267 | 267 |
| 268 void ListFileEntries(const base::ListValue* args); | 268 void ListFileEntries(const base::ListValue* args); |
| 269 | 269 |
| 270 // The last event sent to the JavaScript side. | 270 // The last event sent to the JavaScript side. |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 void DriveInternalsWebUIHandler::UpdateLocalMetadataSection( | 466 void DriveInternalsWebUIHandler::UpdateLocalMetadataSection( |
| 467 google_apis::DriveServiceInterface* drive_service) { | 467 google_apis::DriveServiceInterface* drive_service) { |
| 468 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 468 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 469 | 469 |
| 470 GetSystemService()->file_system()->GetMetadata( | 470 GetSystemService()->file_system()->GetMetadata( |
| 471 base::Bind(&DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal, | 471 base::Bind(&DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal, |
| 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::FileSystemMetadata& 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-refreshing", metadata.refreshing); | 482 local_metadata.SetBoolean("account-metadata-refreshing", metadata.refreshing); |
| 483 web_ui()->CallJavascriptFunction("updateLocalMetadata", local_metadata); | 483 web_ui()->CallJavascriptFunction("updateLocalMetadata", local_metadata); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void DriveInternalsWebUIHandler::ClearAccessToken(const base::ListValue* args) { | 486 void DriveInternalsWebUIHandler::ClearAccessToken(const base::ListValue* args) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 505 void DriveInternalsWebUIHandler::UpdateDeltaUpdateStatusSection() { | 505 void DriveInternalsWebUIHandler::UpdateDeltaUpdateStatusSection() { |
| 506 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 506 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 507 | 507 |
| 508 GetSystemService()->file_system()->GetMetadata( | 508 GetSystemService()->file_system()->GetMetadata( |
| 509 base::Bind( | 509 base::Bind( |
| 510 &DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate, | 510 &DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate, |
| 511 weak_ptr_factory_.GetWeakPtr())); | 511 weak_ptr_factory_.GetWeakPtr())); |
| 512 } | 512 } |
| 513 | 513 |
| 514 void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate( | 514 void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate( |
| 515 const drive::DriveFileSystemMetadata& metadata) { | 515 const drive::FileSystemMetadata& metadata) { |
| 516 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 516 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 517 Profile* profile = Profile::FromWebUI(web_ui()); | 517 Profile* profile = Profile::FromWebUI(web_ui()); |
| 518 google_apis::DriveNotificationManager* drive_notification_manager = | 518 google_apis::DriveNotificationManager* drive_notification_manager = |
| 519 google_apis::DriveNotificationManagerFactory::GetForProfile(profile); | 519 google_apis::DriveNotificationManagerFactory::GetForProfile(profile); |
| 520 if (!drive_notification_manager) | 520 if (!drive_notification_manager) |
| 521 return; | 521 return; |
| 522 | 522 |
| 523 base::DictionaryValue delta_update_status; | 523 base::DictionaryValue delta_update_status; |
| 524 delta_update_status.SetBoolean( | 524 delta_update_status.SetBoolean( |
| 525 "push-notification-enabled", | 525 "push-notification-enabled", |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); | 745 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); |
| 746 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); | 746 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); |
| 747 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); | 747 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); |
| 748 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); | 748 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); |
| 749 | 749 |
| 750 Profile* profile = Profile::FromWebUI(web_ui); | 750 Profile* profile = Profile::FromWebUI(web_ui); |
| 751 content::WebUIDataSource::Add(profile, source); | 751 content::WebUIDataSource::Add(profile, source); |
| 752 } | 752 } |
| 753 | 753 |
| 754 } // namespace chromeos | 754 } // namespace chromeos |
| OLD | NEW |