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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager_util.cc

Issue 12213075: Swap deprecated BrowserList:: iterators for BrowserIterator in non-Windows code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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) 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 #include "chrome/browser/chromeos/extensions/file_manager_util.h" 4 #include "chrome/browser/chromeos/extensions/file_manager_util.h"
5 5
6 #include "ash/shell.h" 6 #include "ash/shell.h"
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/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/extensions/crx_installer.h" 25 #include "chrome/browser/extensions/crx_installer.h"
26 #include "chrome/browser/extensions/extension_install_prompt.h" 26 #include "chrome/browser/extensions/extension_install_prompt.h"
27 #include "chrome/browser/extensions/extension_service.h" 27 #include "chrome/browser/extensions/extension_service.h"
28 #include "chrome/browser/extensions/extension_system.h" 28 #include "chrome/browser/extensions/extension_system.h"
29 #include "chrome/browser/google_apis/task_util.h" 29 #include "chrome/browser/google_apis/task_util.h"
30 #include "chrome/browser/plugins/plugin_prefs.h" 30 #include "chrome/browser/plugins/plugin_prefs.h"
31 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/profiles/profile_manager.h" 32 #include "chrome/browser/profiles/profile_manager.h"
33 #include "chrome/browser/ui/browser.h" 33 #include "chrome/browser/ui/browser.h"
34 #include "chrome/browser/ui/browser_finder.h" 34 #include "chrome/browser/ui/browser_finder.h"
35 #include "chrome/browser/ui/browser_list.h" 35 #include "chrome/browser/ui/browser_iterator.h"
36 #include "chrome/browser/ui/browser_tabstrip.h" 36 #include "chrome/browser/ui/browser_tabstrip.h"
37 #include "chrome/browser/ui/browser_window.h" 37 #include "chrome/browser/ui/browser_window.h"
38 #include "chrome/browser/ui/extensions/application_launch.h" 38 #include "chrome/browser/ui/extensions/application_launch.h"
39 #include "chrome/browser/ui/host_desktop.h" 39 #include "chrome/browser/ui/host_desktop.h"
40 #include "chrome/browser/ui/simple_message_box.h" 40 #include "chrome/browser/ui/simple_message_box.h"
41 #include "chrome/browser/ui/tabs/tab_strip_model.h" 41 #include "chrome/browser/ui/tabs/tab_strip_model.h"
42 #include "chrome/common/chrome_paths.h" 42 #include "chrome/common/chrome_paths.h"
43 #include "chrome/common/chrome_switches.h" 43 #include "chrome/common/chrome_switches.h"
44 #include "chrome/common/url_constants.h" 44 #include "chrome/common/url_constants.h"
45 #include "content/public/browser/browser_thread.h" 45 #include "content/public/browser/browser_thread.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 bool FileManageTabExists(const FilePath& path, TAB_REUSE_MODE mode) { 304 bool FileManageTabExists(const FilePath& path, TAB_REUSE_MODE mode) {
305 if (mode == REUSE_NEVER) 305 if (mode == REUSE_NEVER)
306 return false; 306 return false;
307 307
308 // We always open full-tab File Manager via chrome://files URL, never 308 // We always open full-tab File Manager via chrome://files URL, never
309 // chrome-extension://, so we only check against chrome://files 309 // chrome-extension://, so we only check against chrome://files
310 const GURL origin(chrome::kChromeUIFileManagerURL); 310 const GURL origin(chrome::kChromeUIFileManagerURL);
311 const std::string ref = std::string("/") + path.value(); 311 const std::string ref = std::string("/") + path.value();
312 312
313 for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); 313 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
tfarina 2013/02/08 02:49:18 nice! much cleaner :) Thank you.
314 browser_iterator != BrowserList::end(); ++browser_iterator) { 314 Browser* browser = *it;
315 Browser* browser = *browser_iterator;
316 TabStripModel* tab_strip = browser->tab_strip_model(); 315 TabStripModel* tab_strip = browser->tab_strip_model();
317 for (int idx = 0; idx < tab_strip->count(); idx++) { 316 for (int idx = 0; idx < tab_strip->count(); idx++) {
318 content::WebContents* web_contents = tab_strip->GetWebContentsAt(idx); 317 content::WebContents* web_contents = tab_strip->GetWebContentsAt(idx);
319 const GURL& url = web_contents->GetURL(); 318 const GURL& url = web_contents->GetURL();
320 if (origin == url.GetOrigin()) { 319 if (origin == url.GetOrigin()) {
321 if (mode == REUSE_ANY_FILE_MANAGER || ref == url.ref()) { 320 if (mode == REUSE_ANY_FILE_MANAGER || ref == url.ref()) {
322 if (mode == REUSE_SAME_PATH && tab_strip->active_index() != idx) { 321 if (mode == REUSE_SAME_PATH && tab_strip->active_index() != idx) {
323 browser->window()->Show(); 322 browser->window()->Show();
324 tab_strip->ActivateTabAt(idx, false); 323 tab_strip->ActivateTabAt(idx, false);
325 } 324 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 return; 426 return;
428 427
429 chrome::AppLaunchParams params(profile, extension, 428 chrome::AppLaunchParams params(profile, extension,
430 extension_misc::LAUNCH_WINDOW, 429 extension_misc::LAUNCH_WINDOW,
431 NEW_FOREGROUND_TAB); 430 NEW_FOREGROUND_TAB);
432 params.override_url = GURL(url); 431 params.override_url = GURL(url);
433 chrome::OpenApplication(params); 432 chrome::OpenApplication(params);
434 } 433 }
435 434
436 Browser* GetBrowserForUrl(GURL target_url) { 435 Browser* GetBrowserForUrl(GURL target_url) {
437 for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); 436 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
438 browser_iterator != BrowserList::end(); ++browser_iterator) { 437 Browser* browser = *it;
439 Browser* browser = *browser_iterator;
440 TabStripModel* tab_strip = browser->tab_strip_model(); 438 TabStripModel* tab_strip = browser->tab_strip_model();
441 for (int idx = 0; idx < tab_strip->count(); idx++) { 439 for (int idx = 0; idx < tab_strip->count(); idx++) {
442 content::WebContents* web_contents = tab_strip->GetWebContentsAt(idx); 440 content::WebContents* web_contents = tab_strip->GetWebContentsAt(idx);
443 const GURL& url = web_contents->GetURL(); 441 const GURL& url = web_contents->GetURL();
444 if (url == target_url) 442 if (url == target_url)
445 return browser; 443 return browser;
446 } 444 }
447 } 445 }
448 return NULL; 446 return NULL;
449 } 447 }
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 for (google_apis::OperationProgressStatusList::const_iterator iter = 944 for (google_apis::OperationProgressStatusList::const_iterator iter =
947 list.begin(); 945 list.begin();
948 iter != list.end(); ++iter) { 946 iter != list.end(); ++iter) {
949 result_list->Append( 947 result_list->Append(
950 ProgessStatusToDictionaryValue(profile, extension_id, *iter)); 948 ProgessStatusToDictionaryValue(profile, extension_id, *iter));
951 } 949 }
952 return result_list.release(); 950 return result_list.release();
953 } 951 }
954 952
955 } // namespace file_manager_util 953 } // namespace file_manager_util
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/boot_times_loader.cc ('k') | chrome/browser/chromeos/media/media_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698