| OLD | NEW |
| 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/chromeos/gdata/gdata_parser.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_parser.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 InstalledApp::InstalledApp() : supports_create_(false) { | 921 InstalledApp::InstalledApp() : supports_create_(false) { |
| 922 } | 922 } |
| 923 | 923 |
| 924 InstalledApp::~InstalledApp() { | 924 InstalledApp::~InstalledApp() { |
| 925 } | 925 } |
| 926 | 926 |
| 927 InstalledApp::IconList InstalledApp::GetIconsForCategory( | 927 InstalledApp::IconList InstalledApp::GetIconsForCategory( |
| 928 AppIcon::IconCategory category) const { | 928 AppIcon::IconCategory category) const { |
| 929 IconList result; | 929 IconList result; |
| 930 | 930 |
| 931 for (ScopedVector<AppIcon>::const_iterator icon_iter = app_icons_->begin(); | 931 for (ScopedVector<AppIcon>::const_iterator icon_iter = app_icons_.begin(); |
| 932 icon_iter != app_icons_.end(); ++icon_iter) { | 932 icon_iter != app_icons_.end(); ++icon_iter) { |
| 933 if ((*icon_iter)->category() != category) | 933 if ((*icon_iter)->category() != category) |
| 934 continue; | 934 continue; |
| 935 GURL icon_url = (*icon_iter)->GetIconURL(); | 935 GURL icon_url = (*icon_iter)->GetIconURL(); |
| 936 if (icon_url.is_empty()) | 936 if (icon_url.is_empty()) |
| 937 continue; | 937 continue; |
| 938 result.push_back(std::make_pair((*icon_iter)->icon_side_length(), | 938 result.push_back(std::make_pair((*icon_iter)->icon_side_length(), |
| 939 icon_url)); | 939 icon_url)); |
| 940 } | 940 } |
| 941 | 941 |
| 942 // Return a sorted list, smallest to largest. | 942 // Return a sorted list, smallest to largest. |
| 943 std::sort(result.begin(), result.end(), SortBySize); | 943 std::sort(result.begin(), result.end(), SortBySize); |
| 944 return result; | 944 return result; |
| 945 } | 945 } |
| 946 | 946 |
| 947 GURL InstalledApp::GetProductUrl() const { | 947 GURL InstalledApp::GetProductUrl() const { |
| 948 for (ScopedVector<Link>::const_iterator it = links_->begin(); | 948 for (ScopedVector<Link>::const_iterator it = links_.begin(); |
| 949 it != links_.end(); ++it) { | 949 it != links_.end(); ++it) { |
| 950 const Link* link = *it; | 950 const Link* link = *it; |
| 951 if (link->type() == Link::PRODUCT) | 951 if (link->type() == Link::PRODUCT) |
| 952 return link->href(); | 952 return link->href(); |
| 953 } | 953 } |
| 954 return GURL(); | 954 return GURL(); |
| 955 } | 955 } |
| 956 | 956 |
| 957 // static | 957 // static |
| 958 bool InstalledApp::GetValueString(const base::Value* value, | 958 bool InstalledApp::GetValueString(const base::Value* value, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 bool AccountMetadataFeed::Parse(const base::Value& value) { | 1047 bool AccountMetadataFeed::Parse(const base::Value& value) { |
| 1048 base::JSONValueConverter<AccountMetadataFeed> converter; | 1048 base::JSONValueConverter<AccountMetadataFeed> converter; |
| 1049 if (!converter.Convert(value, this)) { | 1049 if (!converter.Convert(value, this)) { |
| 1050 LOG(ERROR) << "Unable to parse: Invalid account metadata feed!"; | 1050 LOG(ERROR) << "Unable to parse: Invalid account metadata feed!"; |
| 1051 return false; | 1051 return false; |
| 1052 } | 1052 } |
| 1053 return true; | 1053 return true; |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 } // namespace gdata | 1056 } // namespace gdata |
| OLD | NEW |