summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottbyer@google.com <scottbyer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 21:33:38 +0000
committerscottbyer@google.com <scottbyer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 21:33:38 +0000
commit7f71e75e4eb1decfdc52f28b2ec48671d09f373b (patch)
tree5c145a4c17662cb2a848c5aa6903c1d1904d9c7a
parent545252a40e5a570e70e671e26c34a31545027fc8 (diff)
downloadchromium_src-7f71e75e4eb1decfdc52f28b2ec48671d09f373b.zip
chromium_src-7f71e75e4eb1decfdc52f28b2ec48671d09f373b.tar.gz
chromium_src-7f71e75e4eb1decfdc52f28b2ec48671d09f373b.tar.bz2
Derive the manage URL from the cloud print root in prefs.
Allows for different cloud print service providers. BUG=56850 TEST=Use the Manage button in the cloud print section of advanced prefs. Review URL: http://codereview.chromium.org/3602003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61239 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_url.cc10
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_url.h1
-rw-r--r--chrome/browser/printing/print_dialog_cloud_unittest.cc9
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc5
4 files changed, 22 insertions, 3 deletions
diff --git a/chrome/browser/printing/cloud_print/cloud_print_url.cc b/chrome/browser/printing/cloud_print/cloud_print_url.cc
index 25a6e2a..61f3909 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_url.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_url.cc
@@ -49,3 +49,13 @@ GURL CloudPrintURL::GetCloudPrintServiceDialogURL() {
replacements);
return cloud_print_dialog_url;
}
+
+GURL CloudPrintURL::GetCloudPrintServiceManageURL() {
+ GURL cloud_print_service_url = GetCloudPrintServiceURL();
+ std::string path(cloud_print_service_url.path() + "/manage.html");
+ GURL::Replacements replacements;
+ replacements.SetPathStr(path);
+ GURL cloud_print_manage_url = cloud_print_service_url.ReplaceComponents(
+ replacements);
+ return cloud_print_manage_url;
+}
diff --git a/chrome/browser/printing/cloud_print/cloud_print_url.h b/chrome/browser/printing/cloud_print/cloud_print_url.h
index aa6458f..157951b 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_url.h
+++ b/chrome/browser/printing/cloud_print/cloud_print_url.h
@@ -16,6 +16,7 @@ class CloudPrintURL {
GURL GetCloudPrintServiceURL();
GURL GetCloudPrintServiceDialogURL();
+ GURL GetCloudPrintServiceManageURL();
private:
void RegisterPreferences();
diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc
index 5cde305..092d456 100644
--- a/chrome/browser/printing/print_dialog_cloud_unittest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc
@@ -177,6 +177,15 @@ TEST_F(CloudPrintURLTest, CheckDefaultURLs) {
EXPECT_THAT(dialog_url, HasSubstr("/client/"));
EXPECT_THAT(dialog_url, Not(HasSubstr("cloudprint/cloudprint")));
EXPECT_THAT(dialog_url, HasSubstr("/dialog.html"));
+
+ std::string manage_url =
+ CloudPrintURL(profile_.get()).
+ GetCloudPrintServiceManageURL().spec();
+ EXPECT_THAT(manage_url, HasSubstr("www.google.com"));
+ EXPECT_THAT(manage_url, HasSubstr("/cloudprint/"));
+ EXPECT_THAT(manage_url, Not(HasSubstr("/client/")));
+ EXPECT_THAT(manage_url, Not(HasSubstr("cloudprint/cloudprint")));
+ EXPECT_THAT(manage_url, HasSubstr("/manage"));
}
// Testing for CloudPrintDataSender needs a mock DOMUI.
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index 9472b5e..c7d0fc75 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_set_observer.h"
#include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
+#include "chrome/browser/printing/cloud_print/cloud_print_url.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
@@ -1441,9 +1442,7 @@ void CloudPrintProxySection::ButtonPressed(views::Button* sender,
// Open a new browser window for the management tab. The browser
// will go away when the user closes that tab.
Browser* browser = Browser::Create(profile());
- // FIXME(scottbyer): Refactor Cloud Print URL creation.
- // http://code.google.com/p/chromium/issues/detail?id=56850
- browser->OpenURL(GURL("https://www.google.com/cloudprint/manage.html"),
+ browser->OpenURL(CloudPrintURL(profile()).GetCloudPrintServiceManageURL(),
GURL(), NEW_WINDOW, PageTransition::LINK);
}
}