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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 base::DictionaryValue* doodle_dictionary = nullptr; | 648 base::DictionaryValue* doodle_dictionary = nullptr; |
649 // Use the supplied TTL as the recheck delay if available. | 649 // Use the supplied TTL as the recheck delay if available. |
650 if (doodle_json->GetAsDictionary(&doodle_dictionary)) { | 650 if (doodle_json->GetAsDictionary(&doodle_dictionary)) { |
651 int time_to_live = 0; | 651 int time_to_live = 0; |
652 if (doodle_dictionary->GetInteger("ddljson.time_to_live_ms", | 652 if (doodle_dictionary->GetInteger("ddljson.time_to_live_ms", |
653 &time_to_live)) { | 653 &time_to_live)) { |
654 recheck_delay = base::TimeDelta::FromMilliseconds(time_to_live); | 654 recheck_delay = base::TimeDelta::FromMilliseconds(time_to_live); |
655 } | 655 } |
656 } | 656 } |
657 | 657 |
658 contents_->GetWebUI()->CallJavascriptFunction( | 658 if (contents_ && contents_->GetWebUI()) { |
659 "appList.startPage.onAppListDoodleUpdated", *doodle_json, | 659 contents_->GetWebUI()->CallJavascriptFunction( |
660 base::StringValue( | 660 "appList.startPage.onAppListDoodleUpdated", *doodle_json, |
661 UIThreadSearchTermsData(profile_).GoogleBaseURLValue())); | 661 base::StringValue( |
| 662 UIThreadSearchTermsData(profile_).GoogleBaseURLValue())); |
| 663 } |
662 } | 664 } |
663 | 665 |
664 // Check for a new doodle. | 666 // Check for a new doodle. |
665 content::BrowserThread::PostDelayedTask( | 667 content::BrowserThread::PostDelayedTask( |
666 content::BrowserThread::UI, FROM_HERE, | 668 content::BrowserThread::UI, FROM_HERE, |
667 base::Bind(&StartPageService::FetchDoodleJson, | 669 base::Bind(&StartPageService::FetchDoodleJson, |
668 weak_factory_.GetWeakPtr()), | 670 weak_factory_.GetWeakPtr()), |
669 recheck_delay); | 671 recheck_delay); |
670 } | 672 } |
671 | 673 |
672 } // namespace app_list | 674 } // namespace app_list |
OLD | NEW |