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

Side by Side Diff: chrome/browser/ui/webui/help/help_ui.cc

Issue 1279093002: Reland of Add channel-specific product logo to chrome://help (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « chrome/browser/resources/help/help_content.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/help/help_ui.h" 5 #include "chrome/browser/ui/webui/help/help_ui.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/help/help_handler.h" 8 #include "chrome/browser/ui/webui/help/help_handler.h"
9 #include "chrome/common/channel_info.h"
9 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "components/version_info/version_info.h"
10 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_ui.h" 13 #include "content/public/browser/web_ui.h"
12 #include "content/public/browser/web_ui_data_source.h" 14 #include "content/public/browser/web_ui_data_source.h"
13 #include "grit/browser_resources.h" 15 #include "grit/browser_resources.h"
16 #include "grit/theme_resources.h"
14 17
15 namespace { 18 namespace {
16 19
17 content::WebUIDataSource* CreateAboutPageHTMLSource() { 20 content::WebUIDataSource* CreateAboutPageHTMLSource() {
18 content::WebUIDataSource* source = 21 content::WebUIDataSource* source =
19 content::WebUIDataSource::Create(chrome::kChromeUIHelpFrameHost); 22 content::WebUIDataSource::Create(chrome::kChromeUIHelpFrameHost);
20 23
21 source->SetJsonPath("strings.js"); 24 source->SetJsonPath("strings.js");
22 source->AddResourcePath("help.js", IDR_HELP_JS); 25 source->AddResourcePath("help.js", IDR_HELP_JS);
23 source->AddResourcePath("help_page.js", IDR_HELP_PAGE_JS); 26 source->AddResourcePath("help_page.js", IDR_HELP_PAGE_JS);
24 source->AddResourcePath("channel_change_page.js", IDR_CHANNEL_CHANGE_PAGE_JS); 27 source->AddResourcePath("channel_change_page.js", IDR_CHANNEL_CHANGE_PAGE_JS);
25 source->SetDefaultResource(IDR_HELP_HTML); 28 source->SetDefaultResource(IDR_HELP_HTML);
26 source->DisableDenyXFrameOptions(); 29 source->DisableDenyXFrameOptions();
30
31 int product_logo = 0;
32 switch (chrome::GetChannel()) {
33 #if defined(GOOGLE_CHROME_BUILD)
34 case version_info::Channel::CANARY:
35 product_logo = IDR_PRODUCT_LOGO_32_CANARY;
36 break;
37 case version_info::Channel::DEV:
38 product_logo = IDR_PRODUCT_LOGO_32_DEV;
39 break;
40 case version_info::Channel::BETA:
41 product_logo = IDR_PRODUCT_LOGO_32_BETA;
42 break;
43 case version_info::Channel::STABLE:
44 product_logo = IDR_PRODUCT_LOGO_32;
45 break;
46 #else
47 case version_info::Channel::CANARY:
48 case version_info::Channel::DEV:
49 case version_info::Channel::BETA:
50 case version_info::Channel::STABLE:
51 NOTREACHED();
52 #endif
53 case version_info::Channel::UNKNOWN:
54 product_logo = IDR_PRODUCT_LOGO_32;
55 break;
56 }
57
58 source->AddResourcePath("current-channel-logo", product_logo);
27 return source; 59 return source;
28 } 60 }
29 61
30 } // namespace 62 } // namespace
31 63
32 HelpUI::HelpUI(content::WebUI* web_ui) 64 HelpUI::HelpUI(content::WebUI* web_ui)
33 : WebUIController(web_ui) { 65 : WebUIController(web_ui) {
34 Profile* profile = Profile::FromWebUI(web_ui); 66 Profile* profile = Profile::FromWebUI(web_ui);
35 content::WebUIDataSource* source = CreateAboutPageHTMLSource(); 67 content::WebUIDataSource* source = CreateAboutPageHTMLSource();
36 68
37 HelpHandler* handler = new HelpHandler(); 69 HelpHandler* handler = new HelpHandler();
38 base::DictionaryValue localized_strings; 70 base::DictionaryValue localized_strings;
39 HelpHandler::GetLocalizedValues(&localized_strings); 71 HelpHandler::GetLocalizedValues(&localized_strings);
40 source->AddLocalizedStrings(localized_strings); 72 source->AddLocalizedStrings(localized_strings);
41 content::WebUIDataSource::Add(profile, source); 73 content::WebUIDataSource::Add(profile, source);
42 web_ui->AddMessageHandler(handler); 74 web_ui->AddMessageHandler(handler);
43 } 75 }
44 76
45 HelpUI::~HelpUI() { 77 HelpUI::~HelpUI() {
46 } 78 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/help/help_content.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698