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

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 27285: Fix crash; dom_ui_ is destroyed by LoadURL. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | Annotate | Revision Log
« 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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/dom_ui/new_tab_ui.h" 7 #include "chrome/browser/dom_ui/new_tab_ui.h"
8 8
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 NewCallback(this, &HistoryHandler::HandleShowHistoryPage)); 712 NewCallback(this, &HistoryHandler::HandleShowHistoryPage));
713 dom_ui->RegisterMessageCallback("searchHistoryPage", 713 dom_ui->RegisterMessageCallback("searchHistoryPage",
714 NewCallback(this, &HistoryHandler::HandleSearchHistoryPage)); 714 NewCallback(this, &HistoryHandler::HandleSearchHistoryPage));
715 } 715 }
716 716
717 void HistoryHandler::HandleShowHistoryPage(const Value*) { 717 void HistoryHandler::HandleShowHistoryPage(const Value*) {
718 NavigationController* controller = dom_ui_->get_contents()->controller(); 718 NavigationController* controller = dom_ui_->get_contents()->controller();
719 if (controller) { 719 if (controller) {
720 #if defined(OS_WIN) 720 #if defined(OS_WIN)
721 // TODO(port): include this once history is converted to HTML 721 // TODO(port): include this once history is converted to HTML
722 controller->LoadURL(HistoryUI::GetBaseURL(), GURL(), PageTransition::LINK);
723 UserMetrics::RecordAction(L"NTP_ShowHistory", 722 UserMetrics::RecordAction(L"NTP_ShowHistory",
724 dom_ui_->get_profile()); 723 dom_ui_->get_profile());
724 controller->LoadURL(HistoryUI::GetBaseURL(), GURL(), PageTransition::LINK);
725 #else 725 #else
726 NOTIMPLEMENTED(); 726 NOTIMPLEMENTED();
727 #endif 727 #endif
728 } 728 }
729 } 729 }
730 730
731 void HistoryHandler::HandleSearchHistoryPage(const Value* content) { 731 void HistoryHandler::HandleSearchHistoryPage(const Value* content) {
732 if (content && content->GetType() == Value::TYPE_LIST) { 732 if (content && content->GetType() == Value::TYPE_LIST) {
733 const ListValue* list_value = static_cast<const ListValue*>(content); 733 const ListValue* list_value = static_cast<const ListValue*>(content);
734 Value* list_member; 734 Value* list_member;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 const GURL&, 875 const GURL&,
876 WindowOpenDisposition disposition) { 876 WindowOpenDisposition disposition) {
877 // The user opened a URL on the page (including "open in new window"). 877 // The user opened a URL on the page (including "open in new window").
878 // We count all such clicks as AUTO_BOOKMARK, which increments the site's 878 // We count all such clicks as AUTO_BOOKMARK, which increments the site's
879 // visit count (which is used for ranking the most visited entries). 879 // visit count (which is used for ranking the most visited entries).
880 // Note this means we're including clicks on not only most visited 880 // Note this means we're including clicks on not only most visited
881 // thumbnails, but also clicks on recently bookmarked. 881 // thumbnails, but also clicks on recently bookmarked.
882 get_contents()->OpenURL(url, GURL(), disposition, 882 get_contents()->OpenURL(url, GURL(), disposition,
883 PageTransition::AUTO_BOOKMARK); 883 PageTransition::AUTO_BOOKMARK);
884 } 884 }
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