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

Side by Side Diff: chrome/browser/dom_ui/filebrowse_ui.cc

Issue 1142005: Mocks for all libcros elements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « chrome/browser/chromeos/text_input/text_input.gyp ('k') | chrome/browser/profile_manager.cc » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/dom_ui/filebrowse_ui.h" 5 #include "chrome/browser/dom_ui/filebrowse_ui.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 25 matching lines...) Expand all
36 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
37 #include "chrome/browser/dom_ui/mediaplayer_ui.h" 37 #include "chrome/browser/dom_ui/mediaplayer_ui.h"
38 #include "net/base/escape.h" 38 #include "net/base/escape.h"
39 39
40 #include "grit/browser_resources.h" 40 #include "grit/browser_resources.h"
41 #include "grit/chromium_strings.h" 41 #include "grit/chromium_strings.h"
42 #include "grit/generated_resources.h" 42 #include "grit/generated_resources.h"
43 #include "grit/locale_settings.h" 43 #include "grit/locale_settings.h"
44 44
45 #if defined(OS_CHROMEOS) 45 #if defined(OS_CHROMEOS)
46 #include "chrome/browser/chromeos/cros/cros_library.h"
46 #include "chrome/browser/chromeos/cros/mount_library.h" 47 #include "chrome/browser/chromeos/cros/mount_library.h"
47 #endif 48 #endif
48 49
49 // Maximum number of search results to return in a given search. We should 50 // Maximum number of search results to return in a given search. We should
50 // eventually remove this. 51 // eventually remove this.
51 static const int kMaxSearchResults = 100; 52 static const int kMaxSearchResults = 100;
52 static const std::wstring kPropertyPath = L"path"; 53 static const std::wstring kPropertyPath = L"path";
53 static const std::wstring kPropertyTitle = L"title"; 54 static const std::wstring kPropertyTitle = L"title";
54 static const std::wstring kPropertyDirectory = L"isDirectory"; 55 static const std::wstring kPropertyDirectory = L"isDirectory";
55 static const std::string kPicasawebUserPrefix = 56 static const std::string kPicasawebUserPrefix =
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // 301 //
301 // FilebrowseHandler 302 // FilebrowseHandler
302 // 303 //
303 //////////////////////////////////////////////////////////////////////////////// 304 ////////////////////////////////////////////////////////////////////////////////
304 FilebrowseHandler::FilebrowseHandler() 305 FilebrowseHandler::FilebrowseHandler()
305 : profile_(NULL), 306 : profile_(NULL),
306 is_refresh_(false), 307 is_refresh_(false),
307 download_manager_(NULL) { 308 download_manager_(NULL) {
308 lister_ = NULL; 309 lister_ = NULL;
309 #if defined(OS_CHROMEOS) 310 #if defined(OS_CHROMEOS)
310 chromeos::MountLibrary* lib = chromeos::MountLibrary::Get(); 311 chromeos::MountLibrary* lib =
312 chromeos::CrosLibrary::Get()->GetMountLibrary();
311 lib->AddObserver(this); 313 lib->AddObserver(this);
312 #endif 314 #endif
313 } 315 }
314 316
315 FilebrowseHandler::~FilebrowseHandler() { 317 FilebrowseHandler::~FilebrowseHandler() {
316 #if defined(OS_CHROMEOS) 318 #if defined(OS_CHROMEOS)
317 chromeos::MountLibrary* lib = chromeos::MountLibrary::Get(); 319 chromeos::MountLibrary* lib =
320 chromeos::CrosLibrary::Get()->GetMountLibrary();
318 lib->RemoveObserver(this); 321 lib->RemoveObserver(this);
319 #endif 322 #endif
320 if (lister_.get()) { 323 if (lister_.get()) {
321 lister_->Cancel(); 324 lister_->Cancel();
322 lister_->set_delegate(NULL); 325 lister_->set_delegate(NULL);
323 } 326 }
324 327
325 ClearDownloadItems(); 328 ClearDownloadItems();
326 download_manager_->RemoveObserver(this); 329 download_manager_->RemoveObserver(this);
327 } 330 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 ChromeThread::PostTask( 433 ChromeThread::PostTask(
431 ChromeThread::UI, FROM_HERE, 434 ChromeThread::UI, FROM_HERE,
432 NewRunnableMethod(CurrentTask_, &TaskProxy::FireUploadCompleteProxy)); 435 NewRunnableMethod(CurrentTask_, &TaskProxy::FireUploadCompleteProxy));
433 } 436 }
434 437
435 void FilebrowseHandler::HandleGetRoots(const Value* value) { 438 void FilebrowseHandler::HandleGetRoots(const Value* value) {
436 ListValue results_value; 439 ListValue results_value;
437 DictionaryValue info_value; 440 DictionaryValue info_value;
438 // TODO(dhg): add other entries, make this more general 441 // TODO(dhg): add other entries, make this more general
439 #if defined(OS_CHROMEOS) 442 #if defined(OS_CHROMEOS)
440 chromeos::MountLibrary* lib = chromeos::MountLibrary::Get(); 443 chromeos::MountLibrary* lib =
444 chromeos::CrosLibrary::Get()->GetMountLibrary();
441 const chromeos::MountLibrary::DiskVector& disks = lib->disks(); 445 const chromeos::MountLibrary::DiskVector& disks = lib->disks();
442 446
443 for (size_t i = 0; i < disks.size(); ++i) { 447 for (size_t i = 0; i < disks.size(); ++i) {
444 if (!disks[i].mount_path.empty()) { 448 if (!disks[i].mount_path.empty()) {
445 DictionaryValue* page_value = new DictionaryValue(); 449 DictionaryValue* page_value = new DictionaryValue();
446 page_value->SetString(kPropertyPath, disks[i].mount_path); 450 page_value->SetString(kPropertyPath, disks[i].mount_path);
447 FilePath currentpath; 451 FilePath currentpath;
448 currentpath = FilePath(disks[i].mount_path); 452 currentpath = FilePath(disks[i].mount_path);
449 std::string filename; 453 std::string filename;
450 filename = currentpath.BaseName().value(); 454 filename = currentpath.BaseName().value();
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 if (url.SchemeIs(chrome::kChromeUIScheme) && 998 if (url.SchemeIs(chrome::kChromeUIScheme) &&
995 url.host() == chrome::kChromeUIFileBrowseHost && 999 url.host() == chrome::kChromeUIFileBrowseHost &&
996 url.ref() == path) { 1000 url.ref() == path) {
997 return (*it); 1001 return (*it);
998 } 1002 }
999 } 1003 }
1000 } 1004 }
1001 1005
1002 return NULL; 1006 return NULL;
1003 } 1007 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/text_input/text_input.gyp ('k') | chrome/browser/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698