OLD | NEW |
---|---|
(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 chrome { | |
15 namespace android { | |
16 | |
17 // 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.
| |
18 bool HandleAndroidNewTabURL(GURL* url, | |
19 content::BrowserContext* browser_context) { | |
20 if (url->SchemeIs(content::kChromeUIScheme) && | |
21 url->host() == chrome::kChromeUINewTabHost) { | |
22 std::string ref = url->ref(); | |
23 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
| |
24 *url = GURL(chrome::kChromeUINativeBookmarksURL); | |
25 } else if (ref == "open_tabs") { | |
26 *url = GURL(chrome::kChromeUINativeRecentTabsURL); | |
27 } else { | |
28 *url = GURL(chrome::kChromeUINativeNewTabURL); | |
29 } | |
30 return true; | |
31 } | |
32 | |
33 if (url->SchemeIs(chrome::kChromeNativeScheme) && | |
34 url->host() == "recent_tabs") { | |
35 *url = GURL(chrome::kChromeUINativeRecentTabsURL); | |
36 return true; | |
37 } | |
38 | |
39 return false; | |
40 } | |
41 | |
42 } // namespace android | |
43 } // namespace chrome | |
OLD | NEW |