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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 268
269 bool PepperFlashComponentInstaller::Install( 269 bool PepperFlashComponentInstaller::Install(
270 const base::DictionaryValue& manifest, 270 const base::DictionaryValue& manifest,
271 const base::FilePath& unpack_path) { 271 const base::FilePath& unpack_path) {
272 Version version; 272 Version version;
273 if (!CheckPepperFlashManifest(manifest, &version)) 273 if (!CheckPepperFlashManifest(manifest, &version))
274 return false; 274 return false;
275 if (current_version_.CompareTo(version) > 0) 275 if (current_version_.CompareTo(version) > 0)
276 return false; 276 return false;
277 if (!file_util::PathExists(unpack_path.Append( 277 if (!base::PathExists(unpack_path.Append(
278 chrome::kPepperFlashPluginFilename))) 278 chrome::kPepperFlashPluginFilename)))
279 return false; 279 return false;
280 // Passed the basic tests. Time to install it. 280 // Passed the basic tests. Time to install it.
281 base::FilePath path = 281 base::FilePath path =
282 GetPepperFlashBaseDirectory().AppendASCII(version.GetString()); 282 GetPepperFlashBaseDirectory().AppendASCII(version.GetString());
283 if (file_util::PathExists(path)) 283 if (base::PathExists(path))
284 return false; 284 return false;
285 if (!base::Move(unpack_path, path)) 285 if (!base::Move(unpack_path, path))
286 return false; 286 return false;
287 // Installation is done. Now tell the rest of chrome. Both the path service 287 // Installation is done. Now tell the rest of chrome. Both the path service
288 // and to the plugin service. 288 // and to the plugin service.
289 current_version_ = version; 289 current_version_ = version;
290 PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path); 290 PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path);
291 path = path.Append(chrome::kPepperFlashPluginFilename); 291 path = path.Append(chrome::kPepperFlashPluginFilename);
292 BrowserThread::PostTask( 292 BrowserThread::PostTask(
293 BrowserThread::UI, FROM_HERE, 293 BrowserThread::UI, FROM_HERE,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 pepflash.version = version; 351 pepflash.version = version;
352 pepflash.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); 352 pepflash.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]);
353 if (cus->RegisterComponent(pepflash) != ComponentUpdateService::kOk) { 353 if (cus->RegisterComponent(pepflash) != ComponentUpdateService::kOk) {
354 NOTREACHED() << "Pepper Flash component registration failed."; 354 NOTREACHED() << "Pepper Flash component registration failed.";
355 } 355 }
356 } 356 }
357 357
358 void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { 358 void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
360 base::FilePath path = GetPepperFlashBaseDirectory(); 360 base::FilePath path = GetPepperFlashBaseDirectory();
361 if (!file_util::PathExists(path)) { 361 if (!base::PathExists(path)) {
362 if (!file_util::CreateDirectory(path)) { 362 if (!file_util::CreateDirectory(path)) {
363 NOTREACHED() << "Could not create Pepper Flash directory."; 363 NOTREACHED() << "Could not create Pepper Flash directory.";
364 return; 364 return;
365 } 365 }
366 } 366 }
367 367
368 Version version(kNullVersion); 368 Version version(kNullVersion);
369 std::vector<base::FilePath> older_dirs; 369 std::vector<base::FilePath> older_dirs;
370 if (GetPepperFlashDirectory(&path, &version, &older_dirs)) { 370 if (GetPepperFlashDirectory(&path, &version, &older_dirs)) {
371 path = path.Append(chrome::kPepperFlashPluginFilename); 371 path = path.Append(chrome::kPepperFlashPluginFilename);
372 if (file_util::PathExists(path)) { 372 if (base::PathExists(path)) {
373 BrowserThread::PostTask( 373 BrowserThread::PostTask(
374 BrowserThread::UI, FROM_HERE, 374 BrowserThread::UI, FROM_HERE,
375 base::Bind(&RegisterPepperFlashWithChrome, path, version)); 375 base::Bind(&RegisterPepperFlashWithChrome, path, version));
376 } else { 376 } else {
377 version = Version(kNullVersion); 377 version = Version(kNullVersion);
378 } 378 }
379 } 379 }
380 380
381 BrowserThread::PostTask( 381 BrowserThread::PostTask(
382 BrowserThread::UI, FROM_HERE, 382 BrowserThread::UI, FROM_HERE,
(...skipping 13 matching lines...) Expand all
396 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) 396 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
397 // Component updated flash supersedes bundled flash therefore if that one 397 // Component updated flash supersedes bundled flash therefore if that one
398 // is disabled then this one should never install. 398 // is disabled then this one should never install.
399 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 399 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
400 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) 400 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash))
401 return; 401 return;
402 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 402 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
403 base::Bind(&StartPepperFlashUpdateRegistration, cus)); 403 base::Bind(&StartPepperFlashUpdateRegistration, cus));
404 #endif 404 #endif
405 } 405 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698