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"
9 #include "base/strings/string_util.h"
10 #include "chrome/common/url_constants.h"
11 #include "content/public/common/url_constants.h"
15 const char kLegacyBookmarksFragment
[] = "bookmarks";
16 const char kLegacyOpenTabsFragment
[] = "open_tabs";
17 const char kLegacyRecentTabsHost
[] = "recent_tabs";
23 bool HandleAndroidNewTabURL(GURL
* url
,
24 content::BrowserContext
* browser_context
) {
25 if (url
->SchemeIs(content::kChromeUIScheme
) &&
26 url
->host() == chrome::kChromeUINewTabHost
) {
27 std::string ref
= url
->ref();
28 if (StartsWithASCII(ref
, kLegacyBookmarksFragment
, true)) {
29 *url
= GURL(chrome::kChromeUINativeBookmarksURL
);
30 } else if (ref
== kLegacyOpenTabsFragment
) {
31 *url
= GURL(chrome::kChromeUINativeRecentTabsURL
);
33 *url
= GURL(chrome::kChromeUINativeNewTabURL
);
38 if (url
->SchemeIs(chrome::kChromeNativeScheme
) &&
39 url
->host() == kLegacyRecentTabsHost
) {
40 *url
= GURL(chrome::kChromeUINativeRecentTabsURL
);
47 } // namespace android