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

Side by Side Diff: trunk/src/chrome/browser/component_updater/pepper_flash_component_installer.cc

Issue 14824006: Revert 198820 "Move FileEnumerator to its own file, do some refa..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 4
5 #include "chrome/browser/component_updater/flash_component_installer.h" 5 #include "chrome/browser/component_updater/flash_component_installer.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/base_paths.h" 11 #include "base/base_paths.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/files/file_enumerator.h"
17 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
18 #include "base/logging.h" 17 #include "base/logging.h"
19 #include "base/path_service.h" 18 #include "base/path_service.h"
20 #include "base/string_util.h" 19 #include "base/string_util.h"
21 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
22 #include "base/strings/string_split.h" 21 #include "base/strings/string_split.h"
23 #include "base/utf_string_conversions.h" 22 #include "base/utf_string_conversions.h"
24 #include "base/values.h" 23 #include "base/values.h"
25 #include "base/version.h" 24 #include "base/version.h"
26 #include "build/build_config.h" 25 #include "build/build_config.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // so we need to enumerate the directories to find the full path. 88 // so we need to enumerate the directories to find the full path.
90 // On success, |latest_dir| returns something like: 89 // On success, |latest_dir| returns something like:
91 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\10.3.44.555\. 90 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\10.3.44.555\.
92 // |latest_version| returns the corresponding version number. |older_dirs| 91 // |latest_version| returns the corresponding version number. |older_dirs|
93 // returns directories of all older versions. 92 // returns directories of all older versions.
94 bool GetPepperFlashDirectory(base::FilePath* latest_dir, 93 bool GetPepperFlashDirectory(base::FilePath* latest_dir,
95 Version* latest_version, 94 Version* latest_version,
96 std::vector<base::FilePath>* older_dirs) { 95 std::vector<base::FilePath>* older_dirs) {
97 base::FilePath base_dir = GetPepperFlashBaseDirectory(); 96 base::FilePath base_dir = GetPepperFlashBaseDirectory();
98 bool found = false; 97 bool found = false;
99 base::FileEnumerator 98 file_util::FileEnumerator
100 file_enumerator(base_dir, false, base::FileEnumerator::DIRECTORIES); 99 file_enumerator(base_dir, false, file_util::FileEnumerator::DIRECTORIES);
101 for (base::FilePath path = file_enumerator.Next(); !path.value().empty(); 100 for (base::FilePath path = file_enumerator.Next(); !path.value().empty();
102 path = file_enumerator.Next()) { 101 path = file_enumerator.Next()) {
103 Version version(path.BaseName().MaybeAsASCII()); 102 Version version(path.BaseName().MaybeAsASCII());
104 if (!version.IsValid()) 103 if (!version.IsValid())
105 continue; 104 continue;
106 if (found) { 105 if (found) {
107 if (version.CompareTo(*latest_version) > 0) { 106 if (version.CompareTo(*latest_version) > 0) {
108 older_dirs->push_back(*latest_dir); 107 older_dirs->push_back(*latest_dir);
109 *latest_dir = path; 108 *latest_dir = path;
110 *latest_version = version; 109 *latest_version = version;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) 387 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
389 // Component updated flash supersedes bundled flash therefore if that one 388 // Component updated flash supersedes bundled flash therefore if that one
390 // is disabled then this one should never install. 389 // is disabled then this one should never install.
391 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 390 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
392 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) 391 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash))
393 return; 392 return;
394 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 393 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
395 base::Bind(&StartPepperFlashUpdateRegistration, cus)); 394 base::Bind(&StartPepperFlashUpdateRegistration, cus));
396 #endif 395 #endif
397 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698