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

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

Issue 10977073: Delete some unused code found by -Wunused-function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: leiz Created 8 years, 2 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
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const char kNullVersion[] = "0.0.0.0"; 74 const char kNullVersion[] = "0.0.0.0";
75 75
76 // The base directory on Windows looks like: 76 // The base directory on Windows looks like:
77 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. 77 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\.
78 FilePath GetPepperFlashBaseDirectory() { 78 FilePath GetPepperFlashBaseDirectory() {
79 FilePath result; 79 FilePath result;
80 PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &result); 80 PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &result);
81 return result; 81 return result;
82 } 82 }
83 83
84 #if defined(GOOGLE_CHROME_BUILD)
84 // Pepper Flash plugins have the version encoded in the path itself 85 // Pepper Flash plugins have the version encoded in the path itself
85 // so we need to enumerate the directories to find the full path. 86 // so we need to enumerate the directories to find the full path.
86 // On success, |latest_dir| returns something like: 87 // On success, |latest_dir| returns something like:
87 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\10.3.44.555\. 88 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\10.3.44.555\.
88 // |latest_version| returns the corresponding version number. |older_dirs| 89 // |latest_version| returns the corresponding version number. |older_dirs|
89 // returns directories of all older versions. 90 // returns directories of all older versions.
90 bool GetPepperFlashDirectory(FilePath* latest_dir, 91 bool GetPepperFlashDirectory(FilePath* latest_dir,
91 Version* latest_version, 92 Version* latest_version,
92 std::vector<FilePath>* older_dirs) { 93 std::vector<FilePath>* older_dirs) {
93 FilePath base_dir = GetPepperFlashBaseDirectory(); 94 FilePath base_dir = GetPepperFlashBaseDirectory();
(...skipping 14 matching lines...) Expand all
108 older_dirs->push_back(path); 109 older_dirs->push_back(path);
109 } 110 }
110 } else { 111 } else {
111 *latest_dir = path; 112 *latest_dir = path;
112 *latest_version = version; 113 *latest_version = version;
113 found = true; 114 found = true;
114 } 115 }
115 } 116 }
116 return found; 117 return found;
117 } 118 }
119 #endif
118 120
119 // Returns true if the Pepper |interface_name| is implemented by this browser. 121 // Returns true if the Pepper |interface_name| is implemented by this browser.
120 // It does not check if the interface is proxied. 122 // It does not check if the interface is proxied.
121 bool SupportsPepperInterface(const char* interface_name) { 123 bool SupportsPepperInterface(const char* interface_name) {
122 if (webkit::ppapi::PluginModule::SupportsInterface(interface_name)) 124 if (webkit::ppapi::PluginModule::SupportsInterface(interface_name))
123 return true; 125 return true;
124 // The PDF interface is invisible to SupportsInterface() on the browser 126 // The PDF interface is invisible to SupportsInterface() on the browser
125 // process because it is provided using PpapiInterfaceFactoryManager. We need 127 // process because it is provided using PpapiInterfaceFactoryManager. We need
126 // to check for that as well. 128 // to check for that as well.
127 // TODO(cpu): make this more sane. 129 // TODO(cpu): make this more sane.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 manifest->GetStringASCII("x-ppapi-arch", &arch); 295 manifest->GetStringASCII("x-ppapi-arch", &arch);
294 if (arch != kPepperFlashArch) 296 if (arch != kPepperFlashArch)
295 return false; 297 return false;
296 298
297 *version_out = version; 299 *version_out = version;
298 return true; 300 return true;
299 } 301 }
300 302
301 namespace { 303 namespace {
302 304
305 #if defined(GOOGLE_CHROME_BUILD)
303 void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus, 306 void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus,
304 const Version& version) { 307 const Version& version) {
305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
306 CrxComponent pepflash; 309 CrxComponent pepflash;
307 pepflash.name = "pepper_flash"; 310 pepflash.name = "pepper_flash";
308 pepflash.installer = new PepperFlashComponentInstaller(version); 311 pepflash.installer = new PepperFlashComponentInstaller(version);
309 pepflash.version = version; 312 pepflash.version = version;
310 pepflash.pk_hash.assign(sha2_hash, &sha2_hash[sizeof(sha2_hash)]); 313 pepflash.pk_hash.assign(sha2_hash, &sha2_hash[sizeof(sha2_hash)]);
311 if (cus->RegisterComponent(pepflash) != ComponentUpdateService::kOk) { 314 if (cus->RegisterComponent(pepflash) != ComponentUpdateService::kOk) {
312 NOTREACHED() << "Pepper Flash component registration failed."; 315 NOTREACHED() << "Pepper Flash component registration failed.";
(...skipping 26 matching lines...) Expand all
339 BrowserThread::PostTask( 342 BrowserThread::PostTask(
340 BrowserThread::UI, FROM_HERE, 343 BrowserThread::UI, FROM_HERE,
341 base::Bind(&FinishPepperFlashUpdateRegistration, cus, version)); 344 base::Bind(&FinishPepperFlashUpdateRegistration, cus, version));
342 345
343 // Remove older versions of Pepper Flash. 346 // Remove older versions of Pepper Flash.
344 for (std::vector<FilePath>::iterator iter = older_dirs.begin(); 347 for (std::vector<FilePath>::iterator iter = older_dirs.begin();
345 iter != older_dirs.end(); ++iter) { 348 iter != older_dirs.end(); ++iter) {
346 file_util::Delete(*iter, true); 349 file_util::Delete(*iter, true);
347 } 350 }
348 } 351 }
352 #endif // defined(GOOGLE_CHROME_BUILD)
349 353
350 } // namespace 354 } // namespace
351 355
352 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { 356 void RegisterPepperFlashComponent(ComponentUpdateService* cus) {
353 #if defined(GOOGLE_CHROME_BUILD) 357 #if defined(GOOGLE_CHROME_BUILD)
354 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 358 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
355 base::Bind(&StartPepperFlashUpdateRegistration, cus)); 359 base::Bind(&StartPepperFlashUpdateRegistration, cus));
356 #endif 360 #endif
357 } 361 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/content_settings/content_settings_pref_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698