Index: chrome/browser/resources/settings/on_startup_page/startup_urls_page_browser_proxy.js |
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_urls_page_browser_proxy.js b/chrome/browser/resources/settings/on_startup_page/startup_urls_page_browser_proxy.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3f9da830ac5b77fae550d1b766873610aba05f3b |
--- /dev/null |
+++ b/chrome/browser/resources/settings/on_startup_page/startup_urls_page_browser_proxy.js |
@@ -0,0 +1,59 @@ |
+// Copyright 2016 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. |
+ |
+cr.define('settings', function() { |
+ /** @interface */ |
+ function StartupUrlsPageBrowserProxy() {} |
+ |
+ StartupUrlsPageBrowserProxy.prototype = { |
+ loadStartupPages: assertNotReached, |
+ |
+ useCurrentPages: assertNotReached, |
+ |
+ /** @param {string} url */ |
+ canAddPage: assertNotReached, |
+ |
+ /** @param {string} url */ |
+ addStartupPage: assertNotReached, |
+ |
+ /** @param {number} index */ |
+ removeStartupPage: assertNotReached, |
+ }; |
+ |
+ /** |
+ * @implements {settings.StartupUrlsPageBrowserProxy} |
+ * @constructor |
+ */ |
+ function StartupUrlsPageBrowserProxyImpl() {} |
+ |
+ cr.addSingletonGetter(StartupUrlsPageBrowserProxyImpl); |
+ |
+ StartupUrlsPageBrowserProxyImpl.prototype = { |
+ loadStartupPages: function() { |
+ chrome.send('onStartupPrefsPageLoad'); |
+ }, |
+ |
+ useCurrentPages: function() { |
+ chrome.send('setStartupPagesToCurrentPages'); |
+ }, |
+ |
+ canAddPage: function(url) { |
+ // TODO(dbeam): hook up to C++ for deeper validation. |
+ return url.trim().length > 0; |
+ }, |
+ |
+ addStartupPage: function(url) { |
+ chrome.send('addStartupPage', [url.trim()]); |
+ }, |
+ |
+ removeStartupPage: function(index) { |
+ chrome.send('removeStartupPage', [index]); |
+ }, |
+ }; |
+ |
+ return { |
+ StartupUrlsPageBrowserProxy: StartupUrlsPageBrowserProxy, |
+ StartupUrlsPageBrowserProxyImpl: StartupUrlsPageBrowserProxyImpl, |
+ }; |
+}); |