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

Side by Side Diff: ui/oobe/oobe_md_ui.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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 | « ui/gl/gl_version_info.cc ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/strings/string_util.h" 5 #include "base/strings/string_util.h"
6 #include "content/public/browser/web_contents.h" 6 #include "content/public/browser/web_contents.h"
7 #include "content/public/browser/web_ui_data_source.h" 7 #include "content/public/browser/web_ui_data_source.h"
8 #include "grit/oobe_resources.h" 8 #include "grit/oobe_resources.h"
9 #include "grit/oobe_resources_map.h" 9 #include "grit/oobe_resources_map.h"
10 #include "ui/oobe/declarations/oobe_web_ui_view.h" 10 #include "ui/oobe/declarations/oobe_web_ui_view.h"
11 #include "ui/oobe/oobe_md_ui.h" 11 #include "ui/oobe/oobe_md_ui.h"
12 12
13 namespace { 13 namespace {
14 14
15 void SetUpDataSource(content::WebUIDataSource* source) { 15 void SetUpDataSource(content::WebUIDataSource* source) {
16 source->SetJsonPath("strings.js"); 16 source->SetJsonPath("strings.js");
17 source->AddResourcePath("", IDR_OOBE_UI_HTML); 17 source->AddResourcePath("", IDR_OOBE_UI_HTML);
18 18
19 // Add all resources defined in "oobe_resources.grd" file at once. 19 // Add all resources defined in "oobe_resources.grd" file at once.
20 const char prefix[] = "resources/"; 20 const char prefix[] = "resources/";
21 const size_t prefix_length = arraysize(prefix) - 1; 21 const size_t prefix_length = arraysize(prefix) - 1;
22 for (size_t i = 0; i < kOobeResourcesSize; ++i) { 22 for (size_t i = 0; i < kOobeResourcesSize; ++i) {
23 std::string name = kOobeResources[i].name; 23 std::string name = kOobeResources[i].name;
24 DCHECK(StartsWithASCII(name, prefix, true)); 24 DCHECK(base::StartsWithASCII(name, prefix, true));
25 source->AddResourcePath(name.substr(prefix_length), 25 source->AddResourcePath(name.substr(prefix_length),
26 kOobeResources[i].value); 26 kOobeResources[i].value);
27 } 27 }
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 OobeMdUI::OobeMdUI(content::WebUI* web_ui, const std::string& host) 32 OobeMdUI::OobeMdUI(content::WebUI* web_ui, const std::string& host)
33 : WebUIController(web_ui) { 33 : WebUIController(web_ui) {
34 content::WebUIDataSource* source = content::WebUIDataSource::Create(host); 34 content::WebUIDataSource* source = content::WebUIDataSource::Create(host);
35 SetUpDataSource(source); 35 SetUpDataSource(source);
36 36
37 view_.reset(new gen::OobeWebUIView(web_ui)); 37 view_.reset(new gen::OobeWebUIView(web_ui));
38 view_->Init(); 38 view_->Init();
39 view_->SetUpDataSource(source); 39 view_->SetUpDataSource(source);
40 40
41 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), 41 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
42 source); 42 source);
43 } 43 }
44 44
45 OobeMdUI::~OobeMdUI() {} 45 OobeMdUI::~OobeMdUI() {}
OLDNEW
« no previous file with comments | « ui/gl/gl_version_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698