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

Side by Side Diff: chrome/browser/extensions/extension_file_browser_private_api.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_file_browser_private_api.h" 5 #include "chrome/browser/extensions/extension_file_browser_private_api.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return true; 226 return true;
227 } 227 }
228 228
229 // Update file handler usage stats. 229 // Update file handler usage stats.
230 void UpdateFileHandlerUsageStats(Profile* profile, const std::string& task_id) { 230 void UpdateFileHandlerUsageStats(Profile* profile, const std::string& task_id) {
231 if (!profile || !profile->GetPrefs()) 231 if (!profile || !profile->GetPrefs())
232 return; 232 return;
233 DictionaryPrefUpdate prefs_usage_update(profile->GetPrefs(), 233 DictionaryPrefUpdate prefs_usage_update(profile->GetPrefs(),
234 prefs::kLastUsedFileBrowserHandlers); 234 prefs::kLastUsedFileBrowserHandlers);
235 prefs_usage_update->SetWithoutPathExpansion(task_id, 235 prefs_usage_update->SetWithoutPathExpansion(task_id,
236 new base::FundamentalValue( 236 base::NumberValue::New(
237 static_cast<int>(base::Time::Now().ToInternalValue()/ 237 static_cast<int>(base::Time::Now().ToInternalValue()/
238 base::Time::kMicrosecondsPerSecond))); 238 base::Time::kMicrosecondsPerSecond)));
239 } 239 }
240 240
241 #ifdef OS_CHROMEOS 241 #ifdef OS_CHROMEOS
242 base::DictionaryValue* MountPointToValue(Profile* profile, 242 base::DictionaryValue* MountPointToValue(Profile* profile,
243 const chromeos::MountLibrary::MountPointInfo& mount_point_info) { 243 const chromeos::MountLibrary::MountPointInfo& mount_point_info) {
244 244
245 base::DictionaryValue *mount_info = new base::DictionaryValue(); 245 base::DictionaryValue *mount_info = new base::DictionaryValue();
246 246
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 *virtual_path, 453 *virtual_path,
454 false); 454 false);
455 if (root_path == FilePath()) 455 if (root_path == FilePath())
456 return false; 456 return false;
457 457
458 *local_path = root_path.Append(*virtual_path); 458 *local_path = root_path.Append(*virtual_path);
459 return true; 459 return true;
460 } 460 }
461 461
462 void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) { 462 void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) {
463 result_.reset(Value::CreateBooleanValue(success)); 463 result_.reset(base::BooleanValue::New(success));
464 SendResponse(success); 464 SendResponse(success);
465 } 465 }
466 466
467 bool FileWatchBrowserFunctionBase::RunImpl() { 467 bool FileWatchBrowserFunctionBase::RunImpl() {
468 if (!render_view_host() || !render_view_host()->process()) 468 if (!render_view_host() || !render_view_host()->process())
469 return false; 469 return false;
470 470
471 // First param is url of a file to watch. 471 // First param is url of a file to watch.
472 std::string url; 472 std::string url;
473 if (!args_->GetString(0, &url) || url.empty()) 473 if (!args_->GetString(0, &url) || url.empty())
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 file_urls.push_back(GURL(origin_file_url)); 789 file_urls.push_back(GURL(origin_file_url));
790 } 790 }
791 // Get local file system instance on file thread. 791 // Get local file system instance on file thread.
792 BrowserThread::PostTask( 792 BrowserThread::PostTask(
793 BrowserThread::FILE, FROM_HERE, 793 BrowserThread::FILE, FROM_HERE,
794 NewRunnableMethod(this, 794 NewRunnableMethod(this,
795 &ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread, 795 &ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread,
796 source_url_, 796 source_url_,
797 task_id, 797 task_id,
798 file_urls)); 798 file_urls));
799 result_.reset(new base::FundamentalValue(true)); 799 result_.reset(base::TrueValue());
800 return true; 800 return true;
801 } 801 }
802 802
803 void ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread( 803 void ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread(
804 const GURL& source_url, const std::string& task_id, 804 const GURL& source_url, const std::string& task_id,
805 const std::vector<GURL>& file_urls) { 805 const std::vector<GURL>& file_urls) {
806 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 806 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
807 fileapi::FileSystemOperation* operation = 807 fileapi::FileSystemOperation* operation =
808 new fileapi::FileSystemOperation( 808 new fileapi::FileSystemOperation(
809 new ExecuteTasksFileSystemCallbackDispatcher( 809 new ExecuteTasksFileSystemCallbackDispatcher(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 return; 853 return;
854 } 854 }
855 855
856 ExtensionEventRouter* event_router = profile_->GetExtensionEventRouter(); 856 ExtensionEventRouter* event_router = profile_->GetExtensionEventRouter();
857 if (!event_router) { 857 if (!event_router) {
858 SendResponse(false); 858 SendResponse(false);
859 return; 859 return;
860 } 860 }
861 861
862 scoped_ptr<ListValue> event_args(new ListValue()); 862 scoped_ptr<ListValue> event_args(new ListValue());
863 event_args->Append(Value::CreateStringValue(action_id)); 863 event_args->Append(base::StringValue::New(action_id));
864 DictionaryValue* details = new DictionaryValue(); 864 DictionaryValue* details = new DictionaryValue();
865 event_args->Append(details); 865 event_args->Append(details);
866 // Get file definitions. These will be replaced with Entry instances by 866 // Get file definitions. These will be replaced with Entry instances by
867 // chromeHidden.Event.dispatchJSON() method from even_binding.js. 867 // chromeHidden.Event.dispatchJSON() method from even_binding.js.
868 ListValue* files_urls = new ListValue(); 868 ListValue* files_urls = new ListValue();
869 details->Set("entries", files_urls); 869 details->Set("entries", files_urls);
870 for (FileDefinitionList::const_iterator iter = file_list.begin(); 870 for (FileDefinitionList::const_iterator iter = file_list.begin();
871 iter != file_list.end(); 871 iter != file_list.end();
872 ++iter) { 872 ++iter) {
873 DictionaryValue* file_def = new DictionaryValue(); 873 DictionaryValue* file_def = new DictionaryValue();
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 #undef SET_STRING 1521 #undef SET_STRING
1522 1522
1523 // TODO(serya): Create a new string in .grd file for this one in M13. 1523 // TODO(serya): Create a new string in .grd file for this one in M13.
1524 dict->SetString("PREVIEW_IMAGE", 1524 dict->SetString("PREVIEW_IMAGE",
1525 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); 1525 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON));
1526 dict->SetString("PLAY_MEDIA", 1526 dict->SetString("PLAY_MEDIA",
1527 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); 1527 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY));
1528 1528
1529 return true; 1529 return true;
1530 } 1530 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_event_router.cc ('k') | chrome/browser/extensions/extension_history_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698