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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 616 |
617 void StartPageService::FetchDoodleJson() { | 617 void StartPageService::FetchDoodleJson() { |
618 if (!search_engine_is_google_) | 618 if (!search_engine_is_google_) |
619 return; | 619 return; |
620 | 620 |
621 GURL::Replacements replacements; | 621 GURL::Replacements replacements; |
622 replacements.SetPathStr(kDoodleJsonPath); | 622 replacements.SetPathStr(kDoodleJsonPath); |
623 | 623 |
624 GURL google_base_url(UIThreadSearchTermsData(profile_).GoogleBaseURLValue()); | 624 GURL google_base_url(UIThreadSearchTermsData(profile_).GoogleBaseURLValue()); |
625 GURL doodle_url = google_base_url.ReplaceComponents(replacements); | 625 GURL doodle_url = google_base_url.ReplaceComponents(replacements); |
626 doodle_fetcher_.reset( | 626 doodle_fetcher_ = |
627 net::URLFetcher::Create(0, doodle_url, net::URLFetcher::GET, this)); | 627 net::URLFetcher::Create(0, doodle_url, net::URLFetcher::GET, this); |
628 doodle_fetcher_->SetRequestContext(profile_->GetRequestContext()); | 628 doodle_fetcher_->SetRequestContext(profile_->GetRequestContext()); |
629 doodle_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 629 doodle_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
630 doodle_fetcher_->Start(); | 630 doodle_fetcher_->Start(); |
631 } | 631 } |
632 | 632 |
633 void StartPageService::OnURLFetchComplete(const net::URLFetcher* source) { | 633 void StartPageService::OnURLFetchComplete(const net::URLFetcher* source) { |
634 std::string json_data; | 634 std::string json_data; |
635 source->GetResponseAsString(&json_data); | 635 source->GetResponseAsString(&json_data); |
636 | 636 |
637 // Remove XSSI guard for JSON parsing. | 637 // Remove XSSI guard for JSON parsing. |
(...skipping 29 matching lines...) Expand all Loading... |
667 | 667 |
668 // Check for a new doodle. | 668 // Check for a new doodle. |
669 content::BrowserThread::PostDelayedTask( | 669 content::BrowserThread::PostDelayedTask( |
670 content::BrowserThread::UI, FROM_HERE, | 670 content::BrowserThread::UI, FROM_HERE, |
671 base::Bind(&StartPageService::FetchDoodleJson, | 671 base::Bind(&StartPageService::FetchDoodleJson, |
672 weak_factory_.GetWeakPtr()), | 672 weak_factory_.GetWeakPtr()), |
673 recheck_delay); | 673 recheck_delay); |
674 } | 674 } |
675 | 675 |
676 } // namespace app_list | 676 } // namespace app_list |
OLD | NEW |