| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 } | 804 } |
| 805 | 805 |
| 806 void DriveInternalsWebUIHandler::OnGetResourceEntryByPath( | 806 void DriveInternalsWebUIHandler::OnGetResourceEntryByPath( |
| 807 const base::FilePath& path, | 807 const base::FilePath& path, |
| 808 drive::FileError error, | 808 drive::FileError error, |
| 809 std::unique_ptr<drive::ResourceEntry> entry) { | 809 std::unique_ptr<drive::ResourceEntry> entry) { |
| 810 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 810 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 811 | 811 |
| 812 if (error == drive::FILE_ERROR_OK) { | 812 if (error == drive::FILE_ERROR_OK) { |
| 813 DCHECK(entry.get()); | 813 DCHECK(entry.get()); |
| 814 const base::StringValue value(FormatEntry(path, *entry) + "\n"); | 814 const base::Value value(FormatEntry(path, *entry) + "\n"); |
| 815 web_ui()->CallJavascriptFunctionUnsafe("updateFileSystemContents", value); | 815 web_ui()->CallJavascriptFunctionUnsafe("updateFileSystemContents", value); |
| 816 } | 816 } |
| 817 } | 817 } |
| 818 | 818 |
| 819 void DriveInternalsWebUIHandler::OnReadDirectoryByPath( | 819 void DriveInternalsWebUIHandler::OnReadDirectoryByPath( |
| 820 const base::FilePath& parent_path, | 820 const base::FilePath& parent_path, |
| 821 drive::FileError error, | 821 drive::FileError error, |
| 822 std::unique_ptr<drive::ResourceEntryVector> entries) { | 822 std::unique_ptr<drive::ResourceEntryVector> entries) { |
| 823 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 823 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 824 | 824 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 839 current_path, | 839 current_path, |
| 840 base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath, | 840 base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath, |
| 841 weak_ptr_factory_.GetWeakPtr(), | 841 weak_ptr_factory_.GetWeakPtr(), |
| 842 current_path)); | 842 current_path)); |
| 843 } | 843 } |
| 844 } | 844 } |
| 845 | 845 |
| 846 // There may be pending ReadDirectoryByPath() calls, but we can update | 846 // There may be pending ReadDirectoryByPath() calls, but we can update |
| 847 // the page with what we have now. This results in progressive | 847 // the page with what we have now. This results in progressive |
| 848 // updates, which is good for a large file system. | 848 // updates, which is good for a large file system. |
| 849 const base::StringValue value(file_system_as_text); | 849 const base::Value value(file_system_as_text); |
| 850 web_ui()->CallJavascriptFunctionUnsafe("updateFileSystemContents", value); | 850 web_ui()->CallJavascriptFunctionUnsafe("updateFileSystemContents", value); |
| 851 } | 851 } |
| 852 } | 852 } |
| 853 | 853 |
| 854 void DriveInternalsWebUIHandler::UpdateCacheEntry( | 854 void DriveInternalsWebUIHandler::UpdateCacheEntry( |
| 855 const std::string& local_id, | 855 const std::string& local_id, |
| 856 const drive::FileCacheEntry& cache_entry) { | 856 const drive::FileCacheEntry& cache_entry) { |
| 857 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 857 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 858 | 858 |
| 859 // Convert |cache_entry| into a dictionary. | 859 // Convert |cache_entry| into a dictionary. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); | 899 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); |
| 900 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); | 900 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); |
| 901 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); | 901 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); |
| 902 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); | 902 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); |
| 903 | 903 |
| 904 Profile* profile = Profile::FromWebUI(web_ui); | 904 Profile* profile = Profile::FromWebUI(web_ui); |
| 905 content::WebUIDataSource::Add(profile, source); | 905 content::WebUIDataSource::Add(profile, source); |
| 906 } | 906 } |
| 907 | 907 |
| 908 } // namespace chromeos | 908 } // namespace chromeos |
| OLD | NEW |