Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: chrome/browser/ui/app_list/start_page_service.cc

Issue 949823002: Fix crash on app list start page contents not existing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698