OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/first_run/first_run_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_ui.h" |
6 | 6 |
7 #include "ash/shell.h" | |
8 #include "base/command_line.h" | 7 #include "base/command_line.h" |
9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h" | 9 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h" |
11 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
12 #include "chrome/grit/chromium_strings.h" | 11 #include "chrome/grit/chromium_strings.h" |
13 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
14 #include "chromeos/chromeos_switches.h" | 13 #include "chromeos/chromeos_switches.h" |
15 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
16 #include "content/public/browser/web_ui_data_source.h" | 15 #include "content/public/browser/web_ui_data_source.h" |
17 #include "grit/browser_resources.h" | 16 #include "grit/browser_resources.h" |
18 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/base/webui/web_ui_util.h" | 18 #include "ui/base/webui/web_ui_util.h" |
20 | 19 |
20 #if defined(USE_ASH) | |
oshima
2014/10/30 18:08:41
First run impl for athena will be completely diffe
pkotwicz
2014/10/30 21:31:41
Done.
| |
21 #include "ash/shell.h" | |
22 #endif | |
23 | |
21 namespace { | 24 namespace { |
22 | 25 |
23 const char kFirstRunJSPath[] = "first_run.js"; | 26 const char kFirstRunJSPath[] = "first_run.js"; |
27 | |
28 #if defined(USE_ASH) | |
24 const char kShelfAlignmentBottom[] = "bottom"; | 29 const char kShelfAlignmentBottom[] = "bottom"; |
25 const char kShelfAlignmentLeft[] = "left"; | 30 const char kShelfAlignmentLeft[] = "left"; |
26 const char kShelfAlignmentRight[] = "right"; | 31 const char kShelfAlignmentRight[] = "right"; |
32 #endif | |
27 | 33 |
28 void SetLocalizedStrings(base::DictionaryValue* localized_strings) { | 34 void SetLocalizedStrings(base::DictionaryValue* localized_strings) { |
29 localized_strings->SetString( | 35 localized_strings->SetString( |
30 "appListHeader", | 36 "appListHeader", |
31 l10n_util::GetStringUTF16(IDS_FIRST_RUN_APP_LIST_STEP_HEADER)); | 37 l10n_util::GetStringUTF16(IDS_FIRST_RUN_APP_LIST_STEP_HEADER)); |
32 localized_strings->SetString( | 38 localized_strings->SetString( |
33 "appListText1", | 39 "appListText1", |
34 l10n_util::GetStringUTF16(IDS_FIRST_RUN_APP_LIST_STEP_TEXT_1)); | 40 l10n_util::GetStringUTF16(IDS_FIRST_RUN_APP_LIST_STEP_TEXT_1)); |
35 localized_strings->SetString( | 41 localized_strings->SetString( |
36 "appListText2", | 42 "appListText2", |
(...skipping 16 matching lines...) Expand all Loading... | |
53 l10n_util::GetStringUTF16(IDS_FIRST_RUN_HELP_STEP_KEEP_EXPLORING_BUTTON)); | 59 l10n_util::GetStringUTF16(IDS_FIRST_RUN_HELP_STEP_KEEP_EXPLORING_BUTTON)); |
54 localized_strings->SetString( | 60 localized_strings->SetString( |
55 "helpFinishButton", | 61 "helpFinishButton", |
56 l10n_util::GetStringUTF16(IDS_FIRST_RUN_HELP_STEP_FINISH_BUTTON)); | 62 l10n_util::GetStringUTF16(IDS_FIRST_RUN_HELP_STEP_FINISH_BUTTON)); |
57 localized_strings->SetString( | 63 localized_strings->SetString( |
58 "nextButton", l10n_util::GetStringUTF16(IDS_FIRST_RUN_NEXT_BUTTON)); | 64 "nextButton", l10n_util::GetStringUTF16(IDS_FIRST_RUN_NEXT_BUTTON)); |
59 localized_strings->SetBoolean( | 65 localized_strings->SetBoolean( |
60 "transitionsEnabled", | 66 "transitionsEnabled", |
61 CommandLine::ForCurrentProcess()->HasSwitch( | 67 CommandLine::ForCurrentProcess()->HasSwitch( |
62 chromeos::switches::kEnableFirstRunUITransitions)); | 68 chromeos::switches::kEnableFirstRunUITransitions)); |
69 #if defined(USE_ASH) | |
63 std::string shelf_alignment; | 70 std::string shelf_alignment; |
64 ash::Shell* shell = ash::Shell::GetInstance(); | 71 ash::Shell* shell = ash::Shell::GetInstance(); |
65 switch (shell->GetShelfAlignment(shell->GetPrimaryRootWindow())) { | 72 switch (shell->GetShelfAlignment(shell->GetPrimaryRootWindow())) { |
66 case ash::SHELF_ALIGNMENT_BOTTOM: | 73 case ash::SHELF_ALIGNMENT_BOTTOM: |
67 shelf_alignment = kShelfAlignmentBottom; | 74 shelf_alignment = kShelfAlignmentBottom; |
68 break; | 75 break; |
69 case ash::SHELF_ALIGNMENT_LEFT: | 76 case ash::SHELF_ALIGNMENT_LEFT: |
70 shelf_alignment = kShelfAlignmentLeft; | 77 shelf_alignment = kShelfAlignmentLeft; |
71 break; | 78 break; |
72 case ash::SHELF_ALIGNMENT_RIGHT: | 79 case ash::SHELF_ALIGNMENT_RIGHT: |
73 shelf_alignment = kShelfAlignmentRight; | 80 shelf_alignment = kShelfAlignmentRight; |
74 break; | 81 break; |
75 default: | 82 default: |
76 NOTREACHED() << "Unsupported shelf alignment"; | 83 NOTREACHED() << "Unsupported shelf alignment"; |
77 } | 84 } |
78 localized_strings->SetString("shelfAlignment", shelf_alignment); | 85 localized_strings->SetString("shelfAlignment", shelf_alignment); |
86 #endif | |
79 } | 87 } |
80 | 88 |
81 content::WebUIDataSource* CreateDataSource() { | 89 content::WebUIDataSource* CreateDataSource() { |
82 content::WebUIDataSource* source = | 90 content::WebUIDataSource* source = |
83 content::WebUIDataSource::Create(chrome::kChromeUIFirstRunHost); | 91 content::WebUIDataSource::Create(chrome::kChromeUIFirstRunHost); |
84 source->SetJsonPath("strings.js"); | 92 source->SetJsonPath("strings.js"); |
85 source->SetDefaultResource(IDR_FIRST_RUN_HTML); | 93 source->SetDefaultResource(IDR_FIRST_RUN_HTML); |
86 source->AddResourcePath(kFirstRunJSPath, IDR_FIRST_RUN_JS); | 94 source->AddResourcePath(kFirstRunJSPath, IDR_FIRST_RUN_JS); |
87 base::DictionaryValue localized_strings; | 95 base::DictionaryValue localized_strings; |
88 webui::SetFontAndTextDirection(&localized_strings); | 96 webui::SetFontAndTextDirection(&localized_strings); |
(...skipping 10 matching lines...) Expand all Loading... | |
99 : WebUIController(web_ui), | 107 : WebUIController(web_ui), |
100 actor_(NULL) { | 108 actor_(NULL) { |
101 FirstRunHandler* handler = new FirstRunHandler(); | 109 FirstRunHandler* handler = new FirstRunHandler(); |
102 actor_ = handler; | 110 actor_ = handler; |
103 web_ui->AddMessageHandler(handler); | 111 web_ui->AddMessageHandler(handler); |
104 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), CreateDataSource()); | 112 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), CreateDataSource()); |
105 } | 113 } |
106 | 114 |
107 } // namespace chromeos | 115 } // namespace chromeos |
108 | 116 |
OLD | NEW |