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

Side by Side Diff: chrome/browser/ui/webui/new_tab_ui.cc

Issue 6660028: Decouple TabRestoreService from Browser (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: New version using a seperate class for the delegate Created 9 years, 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/new_tab_ui.h" 7 #include "chrome/browser/ui/webui/new_tab_ui.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 void RecentlyClosedTabsHandler::HandleReopenTab(const ListValue* args) { 116 void RecentlyClosedTabsHandler::HandleReopenTab(const ListValue* args) {
117 Browser* browser = Browser::GetBrowserForController( 117 Browser* browser = Browser::GetBrowserForController(
118 &web_ui_->tab_contents()->controller(), NULL); 118 &web_ui_->tab_contents()->controller(), NULL);
119 if (!browser) 119 if (!browser)
120 return; 120 return;
121 121
122 int session_to_restore; 122 int session_to_restore;
123 if (ExtractIntegerValue(args, &session_to_restore)) 123 if (ExtractIntegerValue(args, &session_to_restore))
124 tab_restore_service_->RestoreEntryById(browser, session_to_restore, true); 124 tab_restore_service_->RestoreEntryById(
125 browser->tab_restore_service_delegate(), session_to_restore, true);
125 // The current tab has been nuked at this point; don't touch any member 126 // The current tab has been nuked at this point; don't touch any member
126 // variables. 127 // variables.
127 } 128 }
128 129
129 void RecentlyClosedTabsHandler::HandleGetRecentlyClosedTabs( 130 void RecentlyClosedTabsHandler::HandleGetRecentlyClosedTabs(
130 const ListValue* args) { 131 const ListValue* args) {
131 if (!tab_restore_service_) { 132 if (!tab_restore_service_) {
132 tab_restore_service_ = web_ui_->GetProfile()->GetTabRestoreService(); 133 tab_restore_service_ = web_ui_->GetProfile()->GetTabRestoreService();
133 134
134 // GetTabRestoreService() can return NULL (i.e., when in Off the 135 // GetTabRestoreService() can return NULL (i.e., when in Off the
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 SendResponse(request_id, html_bytes); 596 SendResponse(request_id, html_bytes);
596 } 597 }
597 598
598 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { 599 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const {
599 return "text/html"; 600 return "text/html";
600 } 601 }
601 602
602 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { 603 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const {
603 return false; 604 return false;
604 } 605 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698