| 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" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/sync/glue/session_model_associator.h" | 13 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 14 #include "chrome/browser/sync/glue/synced_session.h" | 14 #include "chrome/browser/sync/glue/synced_session.h" |
| 15 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
| 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 17 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 17 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 18 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 18 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 19 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
| 20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 21 #include "content/browser/webui/web_ui.h" | 21 #include "content/browser/webui/web_ui.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/browser/web_ui_message_handler.h" |
| 23 #include "grit/browser_resources.h" | 24 #include "grit/browser_resources.h" |
| 24 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
| 25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 26 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 27 #include "grit/theme_resources_standard.h" | 28 #include "grit/theme_resources_standard.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 30 | 31 |
| 31 using content::WebContents; | 32 using content::WebContents; |
| 33 using content::WebUIMessageHandler; |
| 32 | 34 |
| 33 namespace { | 35 namespace { |
| 34 | 36 |
| 35 ChromeWebUIDataSource* CreateSessionsUIHTMLSource() { | 37 ChromeWebUIDataSource* CreateSessionsUIHTMLSource() { |
| 36 ChromeWebUIDataSource* source = | 38 ChromeWebUIDataSource* source = |
| 37 new ChromeWebUIDataSource(chrome::kChromeUISessionsHost); | 39 new ChromeWebUIDataSource(chrome::kChromeUISessionsHost); |
| 38 | 40 |
| 39 source->AddLocalizedString("sessionsTitle", IDS_SESSIONS_TITLE); | 41 source->AddLocalizedString("sessionsTitle", IDS_SESSIONS_TITLE); |
| 40 source->AddLocalizedString("sessionsCountFormat", | 42 source->AddLocalizedString("sessionsCountFormat", |
| 41 IDS_SESSIONS_SESSION_COUNT_BANNER_FORMAT); | 43 IDS_SESSIONS_SESSION_COUNT_BANNER_FORMAT); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 264 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 263 profile->GetChromeURLDataManager()->AddDataSource( | 265 profile->GetChromeURLDataManager()->AddDataSource( |
| 264 CreateSessionsUIHTMLSource()); | 266 CreateSessionsUIHTMLSource()); |
| 265 } | 267 } |
| 266 | 268 |
| 267 // static | 269 // static |
| 268 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { | 270 RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { |
| 269 return ResourceBundle::GetSharedInstance(). | 271 return ResourceBundle::GetSharedInstance(). |
| 270 LoadDataResourceBytes(IDR_HISTORY_FAVICON); | 272 LoadDataResourceBytes(IDR_HISTORY_FAVICON); |
| 271 } | 273 } |
| OLD | NEW |