OLD | NEW |
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 "chrome/browser/ui/webui/sessions_ui.h" | 5 #include "chrome/browser/ui/webui/sessions_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" |
10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/sync/glue/session_model_associator.h" | 13 #include "chrome/browser/sync/glue/session_model_associator.h" |
12 #include "chrome/browser/sync/glue/synced_session.h" | 14 #include "chrome/browser/sync/glue/synced_session.h" |
13 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
15 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 17 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
16 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 18 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
17 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
18 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
19 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 106 |
105 SessionsDOMHandler::~SessionsDOMHandler() { | 107 SessionsDOMHandler::~SessionsDOMHandler() { |
106 } | 108 } |
107 | 109 |
108 WebUIMessageHandler* SessionsDOMHandler::Attach(WebUI* web_ui) { | 110 WebUIMessageHandler* SessionsDOMHandler::Attach(WebUI* web_ui) { |
109 return WebUIMessageHandler::Attach(web_ui); | 111 return WebUIMessageHandler::Attach(web_ui); |
110 } | 112 } |
111 | 113 |
112 void SessionsDOMHandler::RegisterMessages() { | 114 void SessionsDOMHandler::RegisterMessages() { |
113 web_ui_->RegisterMessageCallback("requestSessionList", | 115 web_ui_->RegisterMessageCallback("requestSessionList", |
114 NewCallback(this, &SessionsDOMHandler::HandleRequestSessions)); | 116 base::Bind(&SessionsDOMHandler::HandleRequestSessions, |
| 117 base::Unretained(this))); |
115 } | 118 } |
116 | 119 |
117 void SessionsDOMHandler::HandleRequestSessions(const ListValue* args) { | 120 void SessionsDOMHandler::HandleRequestSessions(const ListValue* args) { |
118 UpdateUI(); | 121 UpdateUI(); |
119 } | 122 } |
120 | 123 |
121 browser_sync::SessionModelAssociator* SessionsDOMHandler::GetModelAssociator() { | 124 browser_sync::SessionModelAssociator* SessionsDOMHandler::GetModelAssociator() { |
122 // We only want to get the model associator if there is one, and it is done | 125 // We only want to get the model associator if there is one, and it is done |
123 // syncing sessions. | 126 // syncing sessions. |
124 Profile* profile = Profile::FromWebUI(web_ui_); | 127 Profile* profile = Profile::FromWebUI(web_ui_); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 259 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
257 profile->GetChromeURLDataManager()->AddDataSource( | 260 profile->GetChromeURLDataManager()->AddDataSource( |
258 CreateSessionsUIHTMLSource()); | 261 CreateSessionsUIHTMLSource()); |
259 } | 262 } |
260 | 263 |
261 // static | 264 // static |
262 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { | 265 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { |
263 return ResourceBundle::GetSharedInstance(). | 266 return ResourceBundle::GetSharedInstance(). |
264 LoadDataResourceBytes(IDR_HISTORY_FAVICON); | 267 LoadDataResourceBytes(IDR_HISTORY_FAVICON); |
265 } | 268 } |
OLD | NEW |