summaryrefslogtreecommitdiffstats
path: root/chrome/browser/external_protocol_handler.cc
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-16 14:36:41 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-16 14:36:41 +0000
commit057a9a96a6ab08df982136e2dbfbe6785b327e06 (patch)
tree12f9470cf63b8a7802031234161dc5815ce87355 /chrome/browser/external_protocol_handler.cc
parent9abfae34812add5e6bac420fcd4cc915686afe22 (diff)
downloadchromium_src-057a9a96a6ab08df982136e2dbfbe6785b327e06.zip
chromium_src-057a9a96a6ab08df982136e2dbfbe6785b327e06.tar.gz
chromium_src-057a9a96a6ab08df982136e2dbfbe6785b327e06.tar.bz2
Enable AutocompleteTest, HistoryURLProviderTest,
HistoryContentsProviderTest, and KeywordProviderTest from chrome/browser/autocomplete. NOTIMPLEMENTED bits where HistoryURLProviderTest and AutocompleteTest have UI dependencies, and ExternalProtocolHandler has OS dependencies. Review URL: http://codereview.chromium.org/43034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_protocol_handler.cc')
-rw-r--r--chrome/browser/external_protocol_handler.cc26
1 files changed, 21 insertions, 5 deletions
diff --git a/chrome/browser/external_protocol_handler.cc b/chrome/browser/external_protocol_handler.cc
index 98ab6f1..118f2fe 100644
--- a/chrome/browser/external_protocol_handler.cc
+++ b/chrome/browser/external_protocol_handler.cc
@@ -4,23 +4,29 @@
#include "chrome/browser/external_protocol_handler.h"
+#if defined(OS_WIN)
#include <windows.h>
#include <shellapi.h>
+#endif
+
#include <set>
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/registry.h"
#include "base/string_util.h"
#include "base/thread.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process_impl.h"
-#include "chrome/browser/views/external_protocol_dialog.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/pref_names.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
+#if defined(OS_WIN)
+#include "base/registry.h"
+#include "chrome/browser/views/external_protocol_dialog.h"
+#endif
+
// static
void ExternalProtocolHandler::PrepopulateDictionary(DictionaryValue* win_pref) {
static bool is_warm = false;
@@ -58,13 +64,13 @@ void ExternalProtocolHandler::PrepopulateDictionary(DictionaryValue* win_pref) {
};
bool should_block;
- for (int i = 0; i < arraysize(denied_schemes); ++i) {
+ for (size_t i = 0; i < arraysize(denied_schemes); ++i) {
if (!win_pref->GetBoolean(denied_schemes[i], &should_block)) {
win_pref->SetBoolean(denied_schemes[i], true);
}
}
- for (int i = 0; i < arraysize(allowed_schemes); ++i) {
+ for (size_t i = 0; i < arraysize(allowed_schemes); ++i) {
if (!win_pref->GetBoolean(allowed_schemes[i], &should_block)) {
win_pref->SetBoolean(allowed_schemes[i], false);
}
@@ -105,6 +111,7 @@ ExternalProtocolHandler::BlockState ExternalProtocolHandler::GetBlockState(
void ExternalProtocolHandler::LaunchUrl(const GURL& url,
int render_process_host_id,
int tab_contents_id) {
+#if defined(OS_WIN)
// Escape the input scheme to be sure that the command does not
// have parameters unexpected by the external program.
std::string escaped_url_string = EscapeExternalHandlerValue(url.spec());
@@ -142,10 +149,15 @@ void ExternalProtocolHandler::LaunchUrl(const GURL& url,
NewRunnableFunction(
&ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck,
escaped_url));
+#elif defined(OS_POSIX)
+ // TODO(port): Implement launching external handler.
+ NOTIMPLEMENTED();
+#endif
}
// static
void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) {
+#if defined(OS_WIN)
// Quote the input scheme to be sure that the command does not have
// parameters unexpected by the external program. This url should already
// have been escaped.
@@ -157,7 +169,7 @@ void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) {
// "Some versions of windows (Win2k before SP3, Win XP before SP1) crash in
// ShellExecute on long URLs (bug 161357 on bugzilla.mozilla.org). IE 5 and 6
// support URLS of 2083 chars in length, 2K is safe."
- const int kMaxUrlLength = 2048;
+ const size_t kMaxUrlLength = 2048;
if (escaped_url.length() > kMaxUrlLength) {
NOTREACHED();
return;
@@ -187,6 +199,10 @@ void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) {
// bug 1136923.
return;
}
+#elif defined(OS_POSIX)
+ // TODO(port): Implement launching external handler.
+ NOTIMPLEMENTED();
+#endif
}
// static