Chromium Code Reviews| 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/browser/ui/app_list/start_page_service.h" | 5 #include "chrome/browser/ui/app_list/start_page_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 doodle_fetcher_.reset( | 623 doodle_fetcher_.reset( |
| 624 net::URLFetcher::Create(0, doodle_url, net::URLFetcher::GET, this)); | 624 net::URLFetcher::Create(0, doodle_url, net::URLFetcher::GET, this)); |
| 625 doodle_fetcher_->SetRequestContext(profile_->GetRequestContext()); | 625 doodle_fetcher_->SetRequestContext(profile_->GetRequestContext()); |
| 626 doodle_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 626 doodle_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
| 627 doodle_fetcher_->Start(); | 627 doodle_fetcher_->Start(); |
| 628 } | 628 } |
| 629 | 629 |
| 630 void StartPageService::OnURLFetchComplete(const net::URLFetcher* source) { | 630 void StartPageService::OnURLFetchComplete(const net::URLFetcher* source) { |
| 631 std::string json_data; | 631 std::string json_data; |
| 632 source->GetResponseAsString(&json_data); | 632 source->GetResponseAsString(&json_data); |
| 633 VLOG(1) << "App list doodle data = " << json_data; | |
|
Matt Giuca
2015/02/26 03:07:08
// TODO(calamity): Remove this log after http://cr
calamity
2015/02/26 03:27:25
Changed to a warning log of crashed renderer inste
| |
| 633 | 634 |
| 634 // Remove XSSI guard for JSON parsing. | 635 // Remove XSSI guard for JSON parsing. |
| 635 size_t json_start_index = json_data.find("{"); | 636 size_t json_start_index = json_data.find("{"); |
| 636 base::StringPiece json_data_substr(json_data); | 637 base::StringPiece json_data_substr(json_data); |
| 637 if (json_start_index != std::string::npos) | 638 if (json_start_index != std::string::npos) |
| 638 json_data_substr.remove_prefix(json_start_index); | 639 json_data_substr.remove_prefix(json_start_index); |
| 639 | 640 |
| 640 JSONStringValueSerializer deserializer(json_data_substr); | 641 JSONStringValueSerializer deserializer(json_data_substr); |
| 641 deserializer.set_allow_trailing_comma(true); | 642 deserializer.set_allow_trailing_comma(true); |
| 642 int error_code = 0; | 643 int error_code = 0; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 667 | 668 |
| 668 // Check for a new doodle. | 669 // Check for a new doodle. |
| 669 content::BrowserThread::PostDelayedTask( | 670 content::BrowserThread::PostDelayedTask( |
| 670 content::BrowserThread::UI, FROM_HERE, | 671 content::BrowserThread::UI, FROM_HERE, |
| 671 base::Bind(&StartPageService::FetchDoodleJson, | 672 base::Bind(&StartPageService::FetchDoodleJson, |
| 672 weak_factory_.GetWeakPtr()), | 673 weak_factory_.GetWeakPtr()), |
| 673 recheck_delay); | 674 recheck_delay); |
| 674 } | 675 } |
| 675 | 676 |
| 676 } // namespace app_list | 677 } // namespace app_list |
| OLD | NEW |