OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/common/extensions/chrome_extensions_client.h" | 5 #include "chrome/common/extensions/chrome_extensions_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 NUM_CHANNELS_FOR_HISTOGRAM); | 340 NUM_CHANNELS_FOR_HISTOGRAM); |
341 } | 341 } |
342 | 342 |
343 std::string ChromeExtensionsClient::GetWebstoreBaseURL() const { | 343 std::string ChromeExtensionsClient::GetWebstoreBaseURL() const { |
344 std::string gallery_prefix = extension_urls::kChromeWebstoreBaseURL; | 344 std::string gallery_prefix = extension_urls::kChromeWebstoreBaseURL; |
345 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 345 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
346 switches::kAppsGalleryURL)) | 346 switches::kAppsGalleryURL)) |
347 gallery_prefix = | 347 gallery_prefix = |
348 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 348 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
349 switches::kAppsGalleryURL); | 349 switches::kAppsGalleryURL); |
350 if (base::EndsWith(gallery_prefix, "/", true)) | 350 if (base::EndsWith(gallery_prefix, "/", base::CompareCase::SENSITIVE)) |
351 gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1); | 351 gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1); |
352 return gallery_prefix; | 352 return gallery_prefix; |
353 } | 353 } |
354 | 354 |
355 std::string ChromeExtensionsClient::GetWebstoreUpdateURL() const { | 355 std::string ChromeExtensionsClient::GetWebstoreUpdateURL() const { |
356 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 356 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
357 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) | 357 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) |
358 return cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL); | 358 return cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL); |
359 else | 359 else |
360 return extension_urls::GetDefaultWebstoreUpdateUrl().spec(); | 360 return extension_urls::GetDefaultWebstoreUpdateUrl().spec(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 402 |
403 return image_paths; | 403 return image_paths; |
404 } | 404 } |
405 | 405 |
406 // static | 406 // static |
407 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { | 407 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { |
408 return g_client.Pointer(); | 408 return g_client.Pointer(); |
409 } | 409 } |
410 | 410 |
411 } // namespace extensions | 411 } // namespace extensions |
OLD | NEW |