Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1982)

Unified Diff: chrome/browser/custom_handlers/protocol_handler_registry.cc

Issue 10139002: Preventing our default handlers for ChromeOS to show up or confuse the user (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Second review changes Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/custom_handlers/protocol_handler_registry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/custom_handlers/protocol_handler_registry.cc
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index d81af988fc58af5d2e7f30e6b30679ff451d30bf..06627c6566a84a95eb1a77972a57d9be7e83efc2 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -35,7 +36,30 @@ ProtocolHandlerRegistry::ProtocolHandlerRegistry(Profile* profile,
delegate_(delegate),
enabled_(true),
enabled_io_(enabled_),
- is_loading_(false) {
+ is_loading_(false),
+ fixed_handlers_loaded_(false) {
+}
+
+void ProtocolHandlerRegistry::InstallFixedHandlers() {
+#if defined(OS_CHROMEOS)
+ if (NULL == GetHandlerList(std::string("mailto"))) {
+ ProtocolHandler mail_handler = ProtocolHandler::CreateProtocolHandler(
koz (OOO until 15th September) 2012/04/23 03:43:06 nit: mail_handler -> mailto_handler
Mr4D (OOO till 08-26) 2012/04/23 18:03:53 Done.
+ std::string("mailto"),
koz (OOO until 15th September) 2012/04/23 03:55:35 Replace this with just "mailto"
Mr4D (OOO till 08-26) 2012/04/23 18:03:53 Not sure why this was done, but every other call o
+ GURL("https://mail.google.com/mail/?extsrc=mailto&url=%s"),
+ UTF8ToUTF16(std::string("Google.com Mail")));
koz (OOO until 15th September) 2012/04/23 03:55:35 Could you move the user-facing strings (ie: the ti
Mr4D (OOO till 08-26) 2012/04/23 18:06:21 Done.
+ RegisterProtocolHandler(mail_handler);
+ SetDefault(mail_handler);
+ }
+ if (NULL == GetHandlerList(std::string("webcal"))) {
+ ProtocolHandler cal_handler = ProtocolHandler::CreateProtocolHandler(
koz (OOO until 15th September) 2012/04/23 03:43:06 nit: cal_handler -> webcal_handler
Mr4D (OOO till 08-26) 2012/04/23 18:03:53 Done.
+ std::string("webcal"),
koz (OOO until 15th September) 2012/04/23 03:55:35 Replace this with just "webcal"
Mr4D (OOO till 08-26) 2012/04/23 18:03:53 Ditto
+ GURL("https://www.google.com/calendar/render?cid=%s"),
+ UTF8ToUTF16(std::string("Google Calendar")));
+ RegisterProtocolHandler(cal_handler);
+ SetDefault(cal_handler);
+ }
+#endif
+ fixed_handlers_loaded_ = true;
}
ProtocolHandlerRegistry::~ProtocolHandlerRegistry() {
@@ -195,6 +219,11 @@ bool ShouldRemoveHandlersNotInOS() {
} // namespace
void ProtocolHandlerRegistry::Load() {
+ // We add our default handlers only the first time we come here.
+ // On the next call the defaults will be locked.
koz (OOO until 15th September) 2012/04/23 03:43:06 What does "locked" mean? Could you replace "will b
Mr4D (OOO till 08-26) 2012/04/23 18:03:53 The "locked" comment was a remainder of some code
+ if (!fixed_handlers_loaded_)
+ InstallFixedHandlers();
+
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
is_loading_ = true;
PrefService* prefs = profile_->GetPrefs();
« no previous file with comments | « chrome/browser/custom_handlers/protocol_handler_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698