Chromium Code Reviews| Index: chrome/browser/android/new_tab_page_url_handler.cc |
| diff --git a/chrome/browser/android/new_tab_page_url_handler.cc b/chrome/browser/android/new_tab_page_url_handler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..59efd152b285ce0493c64625f67e360cf0688d45 |
| --- /dev/null |
| +++ b/chrome/browser/android/new_tab_page_url_handler.cc |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/android/new_tab_page_url_handler.h" |
| + |
| +#include <string> |
| + |
| +#include "base/strings/string_util.h" |
| +#include "chrome/common/url_constants.h" |
| +#include "content/public/common/url_constants.h" |
| +#include "url/gurl.h" |
| + |
| +namespace chrome { |
| +namespace android { |
| + |
| +// static |
|
samarth
2014/03/21 22:32:09
It's not really "static". I'd just leave this out
newt (away)
2014/03/26 17:47:25
Done.
|
| +bool HandleAndroidNewTabURL(GURL* url, |
| + content::BrowserContext* browser_context) { |
| + if (url->SchemeIs(content::kChromeUIScheme) && |
| + url->host() == chrome::kChromeUINewTabHost) { |
| + std::string ref = url->ref(); |
| + if (StartsWithASCII(ref, "bookmarks", true)) { |
|
jam
2014/03/21 19:47:26
nit: there are no constants for these already?
i'
newt (away)
2014/03/26 17:47:25
These constants exist only in Java and JavaScript
|
| + *url = GURL(chrome::kChromeUINativeBookmarksURL); |
| + } else if (ref == "open_tabs") { |
| + *url = GURL(chrome::kChromeUINativeRecentTabsURL); |
| + } else { |
| + *url = GURL(chrome::kChromeUINativeNewTabURL); |
| + } |
| + return true; |
| + } |
| + |
| + if (url->SchemeIs(chrome::kChromeNativeScheme) && |
| + url->host() == "recent_tabs") { |
| + *url = GURL(chrome::kChromeUINativeRecentTabsURL); |
| + return true; |
| + } |
| + |
| + return false; |
| +} |
| + |
| +} // namespace android |
| +} // namespace chrome |