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

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

Issue 3296003: FBTF: Move the TabRestoreService::Observer into its own file. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: More mac fixes 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"
35 #include "chrome/browser/sync/profile_sync_service.h" 36 #include "chrome/browser/sync/profile_sync_service.h"
36 #include "chrome/browser/tab_contents/tab_contents.h" 37 #include "chrome/browser/tab_contents/tab_contents.h"
37 #include "chrome/common/chrome_switches.h" 38 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/notification_service.h" 39 #include "chrome/common/notification_service.h"
39 #include "chrome/common/pref_names.h" 40 #include "chrome/common/pref_names.h"
40 #include "chrome/common/url_constants.h" 41 #include "chrome/common/url_constants.h"
41 #include "grit/generated_resources.h" 42 #include "grit/generated_resources.h"
42 43
43 namespace { 44 namespace {
44 45
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Scoping so we can be sure our timeouts don't outlive us. 114 // Scoping so we can be sure our timeouts don't outlive us.
114 base::OneShotTimer<PaintTimer> timer_; 115 base::OneShotTimer<PaintTimer> timer_;
115 116
116 DISALLOW_COPY_AND_ASSIGN(PaintTimer); 117 DISALLOW_COPY_AND_ASSIGN(PaintTimer);
117 }; 118 };
118 119
119 /////////////////////////////////////////////////////////////////////////////// 120 ///////////////////////////////////////////////////////////////////////////////
120 // RecentlyClosedTabsHandler 121 // RecentlyClosedTabsHandler
121 122
122 class RecentlyClosedTabsHandler : public DOMMessageHandler, 123 class RecentlyClosedTabsHandler : public DOMMessageHandler,
123 public TabRestoreService::Observer { 124 public TabRestoreServiceObserver {
124 public: 125 public:
125 RecentlyClosedTabsHandler() : tab_restore_service_(NULL) {} 126 RecentlyClosedTabsHandler() : tab_restore_service_(NULL) {}
126 virtual ~RecentlyClosedTabsHandler(); 127 virtual ~RecentlyClosedTabsHandler();
127 128
128 // DOMMessageHandler implementation. 129 // DOMMessageHandler implementation.
129 virtual void RegisterMessages(); 130 virtual void RegisterMessages();
130 131
131 // Callback for the "reopenTab" message. Rewrites the history of the 132 // Callback for the "reopenTab" message. Rewrites the history of the
132 // currently displayed tab to be the one in TabRestoreService with a 133 // currently displayed tab to be the one in TabRestoreService with a
133 // history of a session passed in through the content pointer. 134 // history of a session passed in through the content pointer.
134 void HandleReopenTab(const ListValue* args); 135 void HandleReopenTab(const ListValue* args);
135 136
136 // Callback for the "getRecentlyClosedTabs" message. 137 // Callback for the "getRecentlyClosedTabs" message.
137 void HandleGetRecentlyClosedTabs(const ListValue* args); 138 void HandleGetRecentlyClosedTabs(const ListValue* args);
138 139
139 // Observer callback for TabRestoreService::Observer. Sends data on 140 // Observer callback for TabRestoreServiceObserver. Sends data on
140 // recently closed tabs to the javascript side of this page to 141 // recently closed tabs to the javascript side of this page to
141 // display to the user. 142 // display to the user.
142 virtual void TabRestoreServiceChanged(TabRestoreService* service); 143 virtual void TabRestoreServiceChanged(TabRestoreService* service);
143 144
144 // Observer callback to notice when our associated TabRestoreService 145 // Observer callback to notice when our associated TabRestoreService
145 // is destroyed. 146 // is destroyed.
146 virtual void TabRestoreServiceDestroyed(TabRestoreService* service); 147 virtual void TabRestoreServiceDestroyed(TabRestoreService* service);
147 148
148 private: 149 private:
149 // Converts a closed tab to the value sent down to the NTP. Returns true on 150 // 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
617 618
618 scoped_refptr<RefCountedBytes> html_bytes = 619 scoped_refptr<RefCountedBytes> html_bytes =
619 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); 620 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record);
620 621
621 SendResponse(request_id, html_bytes); 622 SendResponse(request_id, html_bytes);
622 } 623 }
623 624
624 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { 625 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const {
625 return "text/html"; 626 return "text/html";
626 } 627 }
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