Index: components/omnibox/browser/autocomplete_controller.cc |
diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc |
index 1a175d428d4d3b574c6fcf544b923948eb85d461..9ab05f7592a36bfb822d7cfad874637a995ab03f 100644 |
--- a/components/omnibox/browser/autocomplete_controller.cc |
+++ b/components/omnibox/browser/autocomplete_controller.cc |
@@ -31,6 +31,7 @@ |
#include "components/omnibox/browser/shortcuts_provider.h" |
#include "components/omnibox/browser/zero_suggest_provider.h" |
#include "components/open_from_clipboard/clipboard_recent_content.h" |
+#include "components/open_from_clipboard/clipboard_recent_content_generic.h" |
#include "components/search_engines/template_url.h" |
#include "components/search_engines/template_url_service.h" |
#include "components/strings/grit/components_strings.h" |
@@ -231,6 +232,15 @@ AutocompleteController::AutocompleteController( |
if (provider_types & AutocompleteProvider::TYPE_CLIPBOARD_URL) { |
ClipboardRecentContent* clipboard_recent_content = |
ClipboardRecentContent::GetInstance(); |
+ // On iOS, a global ClipboardRecentContent should've been created by now |
+ // (if enabled). If none has been created (e.g., we're on a different |
+ // platform), use the generic implementation, which AutocompleteController |
+ // will own. |
+ if (!clipboard_recent_content) { |
+ clipboard_recent_content_.reset(new ClipboardRecentContentGeneric()); |
Peter Kasting
2017/04/01 05:54:28
Nit: Prefer =MakeUnique to reset(new
Mark P
2017/04/02 05:33:56
Done.
|
+ ClipboardRecentContent::SetInstance(clipboard_recent_content_.get()); |
+ clipboard_recent_content = clipboard_recent_content_.get(); |
+ } |
if (clipboard_recent_content) { |
Peter Kasting
2017/04/01 05:54:28
It seems like this can't fail now and can be remov
Mark P
2017/04/02 05:33:56
Yeah, I agree that it's more trouble than it's wor
|
providers_.push_back(new ClipboardURLProvider(provider_client_.get(), |
history_url_provider_, |