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 | 8 |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/engine/syncapi.h" | 10 #include "chrome/browser/sync/engine/syncapi.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 NewCallback(this, &SessionsDOMHandler::HandleRequestSessions)); | 112 NewCallback(this, &SessionsDOMHandler::HandleRequestSessions)); |
113 } | 113 } |
114 | 114 |
115 void SessionsDOMHandler::HandleRequestSessions(const ListValue* args) { | 115 void SessionsDOMHandler::HandleRequestSessions(const ListValue* args) { |
116 UpdateUI(); | 116 UpdateUI(); |
117 } | 117 } |
118 | 118 |
119 browser_sync::SessionModelAssociator* SessionsDOMHandler::GetModelAssociator() { | 119 browser_sync::SessionModelAssociator* SessionsDOMHandler::GetModelAssociator() { |
120 // We only want to get the model associator if there is one, and it is done | 120 // We only want to get the model associator if there is one, and it is done |
121 // syncing sessions. | 121 // syncing sessions. |
122 Profile* profile = web_ui_->GetProfile(); | 122 Profile* profile = Profile::FromWebUI(web_ui_); |
123 if (!profile->HasProfileSyncService()) | 123 if (!profile->HasProfileSyncService()) |
124 return NULL; | 124 return NULL; |
125 ProfileSyncService* service = profile->GetProfileSyncService(); | 125 ProfileSyncService* service = profile->GetProfileSyncService(); |
126 if (!service->ShouldPushChanges()) | 126 if (!service->ShouldPushChanges()) |
127 return NULL; | 127 return NULL; |
128 return service->GetSessionModelAssociator(); | 128 return service->GetSessionModelAssociator(); |
129 } | 129 } |
130 | 130 |
131 void SessionsDOMHandler::GetTabList( | 131 void SessionsDOMHandler::GetTabList( |
132 const std::vector<SessionTab*>& tabs, ListValue* tab_list) { | 132 const std::vector<SessionTab*>& tabs, ListValue* tab_list) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 254 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
255 profile->GetChromeURLDataManager()->AddDataSource( | 255 profile->GetChromeURLDataManager()->AddDataSource( |
256 CreateSessionsUIHTMLSource()); | 256 CreateSessionsUIHTMLSource()); |
257 } | 257 } |
258 | 258 |
259 // static | 259 // static |
260 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { | 260 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { |
261 return ResourceBundle::GetSharedInstance(). | 261 return ResourceBundle::GetSharedInstance(). |
262 LoadDataResourceBytes(IDR_HISTORY_FAVICON); | 262 LoadDataResourceBytes(IDR_HISTORY_FAVICON); |
263 } | 263 } |
OLD | NEW |