Extract code handling PrinterProviderAPI from PrintPreviewHandler
[chromium-blink-merge.git] / chrome / browser / android / new_tab_page_url_handler.cc
blob8561c228c60d8a0094c6aa1643bc512a0b64bf2b
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/android/new_tab_page_url_handler.h"
7 #include <string>
9 #include "base/strings/string_util.h"
10 #include "chrome/common/url_constants.h"
11 #include "content/public/common/url_constants.h"
12 #include "url/gurl.h"
14 namespace {
15 const char kBookmarkFolderPath[] = "folder/";
18 namespace chrome {
19 namespace android {
21 bool HandleAndroidNativePageURL(GURL* url,
22 content::BrowserContext* browser_context) {
23 if (url->SchemeIs(content::kChromeUIScheme) &&
24 url->host() == chrome::kChromeUINewTabHost) {
25 *url = GURL(chrome::kChromeUINativeNewTabURL);
26 return true;
29 if (url->SchemeIs(chrome::kChromeNativeScheme) &&
30 url->host() == kChromeUIBookmarksHost) {
31 std::string ref = url->ref();
32 if (!ref.empty()) {
33 *url = GURL(std::string(kChromeUINativeBookmarksURL)
34 .append(kBookmarkFolderPath)
35 .append(ref));
36 return true;
40 return false;
43 } // namespace android
44 } // namespace chrome