diff options
author | shishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-30 17:19:24 +0000 |
---|---|---|
committer | shishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-30 17:19:24 +0000 |
commit | 3e1a818a70a1465d56bb53d5e2bc72e9aee9c220 (patch) | |
tree | 0c2a00942feae4310b3fccded25556ce8b15c99a /chrome/renderer/searchbox/searchbox.cc | |
parent | 846587af5c81aaf19034fc7b7328a6575c80c99b (diff) | |
download | chromium_src-3e1a818a70a1465d56bb53d5e2bc72e9aee9c220.zip chromium_src-3e1a818a70a1465d56bb53d5e2bc72e9aee9c220.tar.gz chromium_src-3e1a818a70a1465d56bb53d5e2bc72e9aee9c220.tar.bz2 |
Switching local omnibox popup to shadowDom and adding field trial flag to enable iframes.
BUG=
Review URL: https://chromiumcodereview.appspot.com/13102002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/searchbox/searchbox.cc')
-rw-r--r-- | chrome/renderer/searchbox/searchbox.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc index 9245eab..7435460 100644 --- a/chrome/renderer/searchbox/searchbox.cc +++ b/chrome/renderer/searchbox/searchbox.cc @@ -4,8 +4,10 @@ #include "chrome/renderer/searchbox/searchbox.h" -#include "base/strings/string_number_conversions.h" +#include "base/metrics/field_trial.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/searchbox/searchbox_extension.h" @@ -399,6 +401,9 @@ bool SearchBox::GenerateDataURLForSuggestionRequest(const GURL& request_url, GURL* data_url) const { DCHECK(data_url); + if (!ShouldUseIframes()) + return false; + // The origin URL is required so that the iframe knows what origin to post // messages to. WebKit::WebView* webview = render_view()->GetWebView(); @@ -479,3 +484,24 @@ void SearchBox::FormatURLForDisplay(string16* url) const { if (EndsWith(*url, ASCIIToUTF16("/"), true)) url->erase(url->length() - 1, 1); } + +// static +bool SearchBox::ShouldUseIframes() { + // TODO(shishir): All the code below is just temporary and needs to be removed + // once support for ShadowDom is removed. + + // The following is hacky. But given the short lifespan of this code + // and the amount of code that would need to be moved/copied for this change, + // it's probably worth it. + static const char kInstantExtendedFieldTrialName[] = "InstantExtended"; + static const char kIframesEnabledFlagWithValue[] = "iframe:1"; + std::string trial_flags = + base::FieldTrialList::FindFullName(kInstantExtendedFieldTrialName); + std::vector<std::string> flags; + Tokenize(trial_flags, " ", &flags); + for (size_t i = 0; i < flags.size(); ++i) { + if (flags[i] == kIframesEnabledFlagWithValue) + return true; + } + return false; +} |