| 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/browser/chromeos/login/user_image_downloader.h" | 5 #include "chrome/browser/chromeos/login/user_image_downloader.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chrome_thread.h" | 14 #include "chrome/browser/chrome_thread.h" |
| 15 #include "chrome/browser/chromeos/login/google_authenticator.h" | 15 #include "chrome/browser/chromeos/login/authenticator.h" |
| 16 #include "chrome/browser/chromeos/login/image_downloader.h" | 16 #include "chrome/browser/chromeos/login/image_downloader.h" |
| 17 #include "chrome/browser/chromeos/login/user_manager.h" | 17 #include "chrome/browser/chromeos/login/user_manager.h" |
| 18 #include "chrome/browser/profile_manager.h" | 18 #include "chrome/browser/profile_manager.h" |
| 19 #include "chrome/common/net/url_fetcher.h" | 19 #include "chrome/common/net/url_fetcher.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 bool UserImageDownloader::IsUserEntry(ListValue* email_list) const { | 151 bool UserImageDownloader::IsUserEntry(ListValue* email_list) const { |
| 152 for (size_t i = 0; i < email_list->GetSize(); ++i) { | 152 for (size_t i = 0; i < email_list->GetSize(); ++i) { |
| 153 DictionaryValue* email_dictionary = NULL; | 153 DictionaryValue* email_dictionary = NULL; |
| 154 if (!email_list->GetDictionary(i, &email_dictionary)) | 154 if (!email_list->GetDictionary(i, &email_dictionary)) |
| 155 continue; | 155 continue; |
| 156 | 156 |
| 157 std::string email; | 157 std::string email; |
| 158 if (!email_dictionary->GetStringASCII("address", &email)) | 158 if (!email_dictionary->GetStringASCII("address", &email)) |
| 159 continue; | 159 continue; |
| 160 | 160 |
| 161 if (GoogleAuthenticator::Canonicalize(email) == username_) | 161 if (Authenticator::Canonicalize(email) == username_) |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 return false; | 164 return false; |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool UserImageDownloader::GetImageURLFromLinks(ListValue* link_list, | 167 bool UserImageDownloader::GetImageURLFromLinks(ListValue* link_list, |
| 168 GURL* image_url) const { | 168 GURL* image_url) const { |
| 169 // In entry's list of links there should be one with rel pointing to photo | 169 // In entry's list of links there should be one with rel pointing to photo |
| 170 // schema. | 170 // schema. |
| 171 for (size_t i = 0; i < link_list->GetSize(); ++i) { | 171 for (size_t i = 0; i < link_list->GetSize(); ++i) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 184 if (!link_dictionary->GetStringASCII("href", &url)) | 184 if (!link_dictionary->GetStringASCII("href", &url)) |
| 185 continue; | 185 continue; |
| 186 | 186 |
| 187 *image_url = GURL(url); | 187 *image_url = GURL(url); |
| 188 return true; | 188 return true; |
| 189 } | 189 } |
| 190 return false; | 190 return false; |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace chromeos | 193 } // namespace chromeos |
| OLD | NEW |