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

Side by Side Diff: chrome/browser/android/new_tab_page_url_handler.cc

Issue 1811333003: Move the remaining NTP realted files to c/b/android/ntp subdir. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync again Created 4 years, 9 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
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/android/new_tab_page_url_handler.h"
6
7 #include <string>
8
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"
13
14 namespace {
15 const char kBookmarkFolderPath[] = "folder/";
16 const char kLegacyWelcomeHost[] = "welcome";
17 }
18
19 namespace chrome {
20 namespace android {
21
22 bool HandleAndroidNativePageURL(GURL* url,
23 content::BrowserContext* browser_context) {
24 if (url->SchemeIs(content::kChromeUIScheme)) {
25 // TODO(newt): stop redirecting chrome://welcome to chrome-native://newtab
26 // when M39 is a distant memory. http://crbug.com/455427
27 if (url->host() == chrome::kChromeUINewTabHost ||
28 url->host() == kLegacyWelcomeHost) {
29 *url = GURL(chrome::kChromeUINativeNewTabURL);
30 return true;
31 }
32
33 if (url->host() == kChromeUIPhysicalWebHost) {
34 *url = GURL(kChromeUINativePhysicalWebURL);
35 return true;
36 }
37 }
38
39 if (url->SchemeIs(chrome::kChromeNativeScheme) &&
40 url->host() == kChromeUIBookmarksHost) {
41 std::string ref = url->ref();
42 if (!ref.empty()) {
43 *url = GURL(std::string(kChromeUINativeBookmarksURL)
44 .append(kBookmarkFolderPath)
45 .append(ref));
46 return true;
47 }
48 }
49
50 return false;
51 }
52
53 } // namespace android
54 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/android/new_tab_page_url_handler.h ('k') | chrome/browser/android/ntp/new_tab_page_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698