| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 // Although |source| is passed in as a const, it's still possible to modify | 1440 // Although |source| is passed in as a const, it's still possible to modify |
| 1441 // it. This is dangerous since the utility process re-uses |source| after | 1441 // it. This is dangerous since the utility process re-uses |source| after |
| 1442 // it calls InitFromValue, passing it up to the browser process which calls | 1442 // it calls InitFromValue, passing it up to the browser process which calls |
| 1443 // InitFromValue again. As a result, we need to make sure that nobody | 1443 // InitFromValue again. As a result, we need to make sure that nobody |
| 1444 // accidentally modifies it. | 1444 // accidentally modifies it. |
| 1445 DCHECK(source.Equals(manifest_value_.get())); | 1445 DCHECK(source.Equals(manifest_value_.get())); |
| 1446 | 1446 |
| 1447 return true; | 1447 return true; |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 GURL Extension::GalleryUrl() const { | |
| 1451 if (!update_url_.DomainIs("google.com")) | |
| 1452 return GURL(); | |
| 1453 | |
| 1454 GURL url(std::string(extension_urls::kGalleryBrowsePrefix) + | |
| 1455 std::string("/detail/") + id_); | |
| 1456 | |
| 1457 return url; | |
| 1458 } | |
| 1459 | |
| 1460 std::set<FilePath> Extension::GetBrowserImages() { | 1450 std::set<FilePath> Extension::GetBrowserImages() { |
| 1461 std::set<FilePath> image_paths; | 1451 std::set<FilePath> image_paths; |
| 1462 | 1452 |
| 1463 // Extension icons. | 1453 // extension icons |
| 1464 for (std::map<int, std::string>::iterator iter = icons_.begin(); | 1454 for (std::map<int, std::string>::iterator iter = icons_.begin(); |
| 1465 iter != icons_.end(); ++iter) { | 1455 iter != icons_.end(); ++iter) { |
| 1466 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(iter->second))); | 1456 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(iter->second))); |
| 1467 } | 1457 } |
| 1468 | 1458 |
| 1469 // Theme images. | 1459 // theme images |
| 1470 DictionaryValue* theme_images = GetThemeImages(); | 1460 DictionaryValue* theme_images = GetThemeImages(); |
| 1471 if (theme_images) { | 1461 if (theme_images) { |
| 1472 for (DictionaryValue::key_iterator it = theme_images->begin_keys(); | 1462 for (DictionaryValue::key_iterator it = theme_images->begin_keys(); |
| 1473 it != theme_images->end_keys(); ++it) { | 1463 it != theme_images->end_keys(); ++it) { |
| 1474 std::wstring val; | 1464 std::wstring val; |
| 1475 if (theme_images->GetStringWithoutPathExpansion(*it, &val)) | 1465 if (theme_images->GetStringWithoutPathExpansion(*it, &val)) |
| 1476 image_paths.insert(FilePath::FromWStringHack(val)); | 1466 image_paths.insert(FilePath::FromWStringHack(val)); |
| 1477 } | 1467 } |
| 1478 } | 1468 } |
| 1479 | 1469 |
| 1480 // Page action icons. | 1470 // page action icons |
| 1481 if (page_action_.get()) { | 1471 if (page_action_.get()) { |
| 1482 std::vector<std::string>* icon_paths = page_action_->icon_paths(); | 1472 std::vector<std::string>* icon_paths = page_action_->icon_paths(); |
| 1483 for (std::vector<std::string>::iterator iter = icon_paths->begin(); | 1473 for (std::vector<std::string>::iterator iter = icon_paths->begin(); |
| 1484 iter != icon_paths->end(); ++iter) { | 1474 iter != icon_paths->end(); ++iter) { |
| 1485 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(*iter))); | 1475 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(*iter))); |
| 1486 } | 1476 } |
| 1487 } | 1477 } |
| 1488 | 1478 |
| 1489 // Browser action icons. | 1479 // browser action icons |
| 1490 if (browser_action_.get()) { | 1480 if (browser_action_.get()) { |
| 1491 std::vector<std::string>* icon_paths = browser_action_->icon_paths(); | 1481 std::vector<std::string>* icon_paths = browser_action_->icon_paths(); |
| 1492 for (std::vector<std::string>::iterator iter = icon_paths->begin(); | 1482 for (std::vector<std::string>::iterator iter = icon_paths->begin(); |
| 1493 iter != icon_paths->end(); ++iter) { | 1483 iter != icon_paths->end(); ++iter) { |
| 1494 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(*iter))); | 1484 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(*iter))); |
| 1495 } | 1485 } |
| 1496 } | 1486 } |
| 1497 | 1487 |
| 1498 return image_paths; | 1488 return image_paths; |
| 1499 } | 1489 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 } else { | 1641 } else { |
| 1652 return false; | 1642 return false; |
| 1653 } | 1643 } |
| 1654 } else { | 1644 } else { |
| 1655 return true; | 1645 return true; |
| 1656 } | 1646 } |
| 1657 } | 1647 } |
| 1658 } | 1648 } |
| 1659 return false; | 1649 return false; |
| 1660 } | 1650 } |
| OLD | NEW |