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

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

Issue 3340007: Revert "FBTF: Move the TabRestoreService::Observer into its own file." (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 3 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <set> 9 #include <set>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/dom_ui/most_visited_handler.h" 25 #include "chrome/browser/dom_ui/most_visited_handler.h"
26 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" 26 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h"
27 #include "chrome/browser/dom_ui/ntp_resource_cache.h" 27 #include "chrome/browser/dom_ui/ntp_resource_cache.h"
28 #include "chrome/browser/dom_ui/shown_sections_handler.h" 28 #include "chrome/browser/dom_ui/shown_sections_handler.h"
29 #include "chrome/browser/metrics/user_metrics.h" 29 #include "chrome/browser/metrics/user_metrics.h"
30 #include "chrome/browser/prefs/pref_service.h" 30 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/browser/profile.h" 31 #include "chrome/browser/profile.h"
32 #include "chrome/browser/renderer_host/render_view_host.h" 32 #include "chrome/browser/renderer_host/render_view_host.h"
33 #include "chrome/browser/sessions/session_types.h" 33 #include "chrome/browser/sessions/session_types.h"
34 #include "chrome/browser/sessions/tab_restore_service.h" 34 #include "chrome/browser/sessions/tab_restore_service.h"
35 #include "chrome/browser/sessions/tab_restore_service_observer.h"
36 #include "chrome/browser/sync/profile_sync_service.h" 35 #include "chrome/browser/sync/profile_sync_service.h"
37 #include "chrome/browser/tab_contents/tab_contents.h" 36 #include "chrome/browser/tab_contents/tab_contents.h"
38 #include "chrome/common/chrome_switches.h" 37 #include "chrome/common/chrome_switches.h"
39 #include "chrome/common/notification_service.h" 38 #include "chrome/common/notification_service.h"
40 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
41 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
42 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
43 42
44 namespace { 43 namespace {
45 44
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Scoping so we can be sure our timeouts don't outlive us. 113 // Scoping so we can be sure our timeouts don't outlive us.
115 base::OneShotTimer<PaintTimer> timer_; 114 base::OneShotTimer<PaintTimer> timer_;
116 115
117 DISALLOW_COPY_AND_ASSIGN(PaintTimer); 116 DISALLOW_COPY_AND_ASSIGN(PaintTimer);
118 }; 117 };
119 118
120 /////////////////////////////////////////////////////////////////////////////// 119 ///////////////////////////////////////////////////////////////////////////////
121 // RecentlyClosedTabsHandler 120 // RecentlyClosedTabsHandler
122 121
123 class RecentlyClosedTabsHandler : public DOMMessageHandler, 122 class RecentlyClosedTabsHandler : public DOMMessageHandler,
124 public TabRestoreServiceObserver { 123 public TabRestoreService::Observer {
125 public: 124 public:
126 RecentlyClosedTabsHandler() : tab_restore_service_(NULL) {} 125 RecentlyClosedTabsHandler() : tab_restore_service_(NULL) {}
127 virtual ~RecentlyClosedTabsHandler(); 126 virtual ~RecentlyClosedTabsHandler();
128 127
129 // DOMMessageHandler implementation. 128 // DOMMessageHandler implementation.
130 virtual void RegisterMessages(); 129 virtual void RegisterMessages();
131 130
132 // Callback for the "reopenTab" message. Rewrites the history of the 131 // Callback for the "reopenTab" message. Rewrites the history of the
133 // currently displayed tab to be the one in TabRestoreService with a 132 // currently displayed tab to be the one in TabRestoreService with a
134 // history of a session passed in through the content pointer. 133 // history of a session passed in through the content pointer.
135 void HandleReopenTab(const ListValue* args); 134 void HandleReopenTab(const ListValue* args);
136 135
137 // Callback for the "getRecentlyClosedTabs" message. 136 // Callback for the "getRecentlyClosedTabs" message.
138 void HandleGetRecentlyClosedTabs(const ListValue* args); 137 void HandleGetRecentlyClosedTabs(const ListValue* args);
139 138
140 // Observer callback for TabRestoreServiceObserver. Sends data on 139 // Observer callback for TabRestoreService::Observer. Sends data on
141 // recently closed tabs to the javascript side of this page to 140 // recently closed tabs to the javascript side of this page to
142 // display to the user. 141 // display to the user.
143 virtual void TabRestoreServiceChanged(TabRestoreService* service); 142 virtual void TabRestoreServiceChanged(TabRestoreService* service);
144 143
145 // Observer callback to notice when our associated TabRestoreService 144 // Observer callback to notice when our associated TabRestoreService
146 // is destroyed. 145 // is destroyed.
147 virtual void TabRestoreServiceDestroyed(TabRestoreService* service); 146 virtual void TabRestoreServiceDestroyed(TabRestoreService* service);
148 147
149 private: 148 private:
150 // Converts a closed tab to the value sent down to the NTP. Returns true on 149 // Converts a closed tab to the value sent down to the NTP. Returns true on
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 617
619 scoped_refptr<RefCountedBytes> html_bytes = 618 scoped_refptr<RefCountedBytes> html_bytes =
620 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); 619 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record);
621 620
622 SendResponse(request_id, html_bytes); 621 SendResponse(request_id, html_bytes);
623 } 622 }
624 623
625 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { 624 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const {
626 return "text/html"; 625 return "text/html";
627 } 626 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/view_id_util_browsertest.mm ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698