Move //components/omnibox into //components/omnibox/browser
//chrome/common/omnibox_focus_state.h needs to be componentized, as it is used
by //chrome/browser/ui/omnibox code. As it's also used by //chrome/renderer, it
needs to be componentized into //components/omnibox/common so that DEPS
allowances/build dependencies have the expected structure (i.e., don't allow
for bleed between renderer and browser code).
BUG=371536
TBR=sky
Review URL: https://codereview.chromium.org/1229613004
Cr-Commit-Position: refs/heads/master@{#338007}
diff --git a/components/omnibox/browser/test_scheme_classifier.cc b/components/omnibox/browser/test_scheme_classifier.cc
new file mode 100644
index 0000000..df9b0d0
--- /dev/null
+++ b/components/omnibox/browser/test_scheme_classifier.cc
@@ -0,0 +1,29 @@
+// Copyright 2014 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.
+
+#include "components/metrics/proto/omnibox_input_type.pb.h"
+#include "components/omnibox/browser/test_scheme_classifier.h"
+#include "net/url_request/url_request.h"
+#include "url/url_constants.h"
+
+TestSchemeClassifier::TestSchemeClassifier() {}
+
+TestSchemeClassifier::~TestSchemeClassifier() {}
+
+metrics::OmniboxInputType::Type TestSchemeClassifier::GetInputTypeForScheme(
+ const std::string& scheme) const {
+ // This doesn't check the preference but check some chrome-ish schemes.
+ const char* kKnownURLSchemes[] = {
+ url::kFileScheme, url::kAboutScheme, url::kFtpScheme, url::kBlobScheme,
+ url::kFileSystemScheme, "view-source", "javascript", "chrome", "chrome-ui",
+ };
+ for (size_t i = 0; i < arraysize(kKnownURLSchemes); ++i) {
+ if (scheme == kKnownURLSchemes[i])
+ return metrics::OmniboxInputType::URL;
+ }
+ if (net::URLRequest::IsHandledProtocol(scheme))
+ return metrics::OmniboxInputType::URL;
+
+ return metrics::OmniboxInputType::INVALID;
+}