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/conflicts_ui.h" | 5 #include "chrome/browser/ui/webui/conflicts_ui.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/enumerate_modules_model_win.h" | 16 #include "chrome/browser/enumerate_modules_model_win.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 18 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
19 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 19 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
22 #include "content/browser/tab_contents/tab_contents.h" | |
23 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
24 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
25 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 26 #include "content/public/browser/web_contents.h" |
27 #include "grit/browser_resources.h" | 27 #include "grit/browser_resources.h" |
28 #include "grit/chromium_strings.h" | 28 #include "grit/chromium_strings.h" |
29 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
30 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
31 #include "grit/theme_resources_standard.h" | 31 #include "grit/theme_resources_standard.h" |
32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
34 | 34 |
35 using content::UserMetricsAction; | 35 using content::UserMetricsAction; |
| 36 using content::WebContents; |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
39 ChromeWebUIDataSource* CreateConflictsUIHTMLSource() { | 40 ChromeWebUIDataSource* CreateConflictsUIHTMLSource() { |
40 ChromeWebUIDataSource* source = | 41 ChromeWebUIDataSource* source = |
41 new ChromeWebUIDataSource(chrome::kChromeUIConflictsHost); | 42 new ChromeWebUIDataSource(chrome::kChromeUIConflictsHost); |
42 | 43 |
43 source->AddLocalizedString("loadingMessage", IDS_CONFLICTS_LOADING_MESSAGE); | 44 source->AddLocalizedString("loadingMessage", IDS_CONFLICTS_LOADING_MESSAGE); |
44 source->AddLocalizedString("modulesLongTitle", | 45 source->AddLocalizedString("modulesLongTitle", |
45 IDS_CONFLICTS_CHECK_PAGE_TITLE_LONG); | 46 IDS_CONFLICTS_CHECK_PAGE_TITLE_LONG); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 150 } |
150 | 151 |
151 } // namespace | 152 } // namespace |
152 | 153 |
153 /////////////////////////////////////////////////////////////////////////////// | 154 /////////////////////////////////////////////////////////////////////////////// |
154 // | 155 // |
155 // ConflictsUI | 156 // ConflictsUI |
156 // | 157 // |
157 /////////////////////////////////////////////////////////////////////////////// | 158 /////////////////////////////////////////////////////////////////////////////// |
158 | 159 |
159 ConflictsUI::ConflictsUI(TabContents* contents) : ChromeWebUI(contents) { | 160 ConflictsUI::ConflictsUI(WebContents* contents) : ChromeWebUI(contents) { |
160 content::RecordAction(UserMetricsAction("ViewAboutConflicts")); | 161 content::RecordAction(UserMetricsAction("ViewAboutConflicts")); |
161 AddMessageHandler(new ConflictsDOMHandler()); | 162 AddMessageHandler(new ConflictsDOMHandler()); |
162 | 163 |
163 // Set up the about:conflicts source. | 164 // Set up the about:conflicts source. |
164 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 165 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
165 profile->GetChromeURLDataManager()->AddDataSource( | 166 profile->GetChromeURLDataManager()->AddDataSource( |
166 CreateConflictsUIHTMLSource()); | 167 CreateConflictsUIHTMLSource()); |
167 } | 168 } |
168 | 169 |
169 // static | 170 // static |
170 RefCountedMemory* ConflictsUI::GetFaviconResourceBytes() { | 171 RefCountedMemory* ConflictsUI::GetFaviconResourceBytes() { |
171 return ResourceBundle::GetSharedInstance(). | 172 return ResourceBundle::GetSharedInstance(). |
172 LoadDataResourceBytes(IDR_CONFLICT_FAVICON); | 173 LoadDataResourceBytes(IDR_CONFLICT_FAVICON); |
173 } | 174 } |
174 | 175 |
175 #endif | 176 #endif |
OLD | NEW |