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

Unified Diff: components/open_from_clipboard/clipboard_recent_content.h

Issue 2801813003: Omnibox - ClipboardRecentContent - Make Proper Singleton (Closed)
Patch Set: jif@'s suggestion Created 3 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
Index: components/open_from_clipboard/clipboard_recent_content.h
diff --git a/components/open_from_clipboard/clipboard_recent_content.h b/components/open_from_clipboard/clipboard_recent_content.h
index e7d55e92e1d3811e1f45c38d8e4a299c68fd8301..564e640d2b96919ff7ea8f625be8b34be2369d3c 100644
--- a/components/open_from_clipboard/clipboard_recent_content.h
+++ b/components/open_from_clipboard/clipboard_recent_content.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_H_
#define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_H_
+#include <memory>
#include <string>
#include "base/macros.h"
@@ -25,7 +26,7 @@ class ClipboardRecentContent {
static ClipboardRecentContent* GetInstance();
// Sets the global instance of ClipboardRecentContent singleton.
- static void SetInstance(ClipboardRecentContent* instance);
+ static void SetInstance(std::unique_ptr<ClipboardRecentContent> instance);
// Returns true if the clipboard contains a recent URL that is appropriate to
// be suggested and has not been supressed, and copies it in |url|.
@@ -48,6 +49,10 @@ class ClipboardRecentContent {
static bool IsAppropriateSuggestion(const GURL& url);
private:
+ // Returns the address of the unique_ptr that stores the current global
+ // ClipboardRecentContent used in GetInstance() / SetInstance().
+ static std::unique_ptr<ClipboardRecentContent>* UniquePtrToInstance();
+
DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContent);
};

Powered by Google App Engine
This is Rietveld 408576698