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

Unified Diff: chrome/browser/extensions/api/system_display/display_info_provider.cc

Issue 476103002: Make DisplayInfoProvider an interface (Closed) Base URL: git@github.com:tmpsantos/chromium.git@display_info
Patch Set: Addressed review comments. Created 6 years, 4 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: chrome/browser/extensions/api/system_display/display_info_provider.cc
diff --git a/chrome/browser/extensions/api/system_display/display_info_provider.cc b/chrome/browser/extensions/api/system_display/display_info_provider.cc
index d57bd15ce0a477cb723337ed4af2b47f92c87ccf..a52563b6df974c011b6588fae2c0be2fbdc6383f 100644
--- a/chrome/browser/extensions/api/system_display/display_info_provider.cc
+++ b/chrome/browser/extensions/api/system_display/display_info_provider.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/api/system_display/display_info_provider.h"
#include "base/strings/string_number_conversions.h"
+#include "chrome/common/extensions/api/system_display.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
@@ -12,6 +13,8 @@ namespace extensions {
namespace {
+DisplayInfoProvider* g_display_info_provider = NULL;
James Cook 2014/08/19 21:48:51 Thanks for moving this.
+
// Converts Rotation enum to integer.
int RotationToDegrees(gfx::Display::Rotation rotation) {
switch (rotation) {
@@ -50,21 +53,19 @@ CreateDisplayUnitInfo(const gfx::Display& display, int64 primary_display_id) {
return unit;
}
-DisplayInfoProvider* g_display_info_provider = NULL;
-
} // namespace
+DisplayInfoProvider::~DisplayInfoProvider() {
+}
-DisplayInfoProvider::DisplayInfoProvider() {}
-
-DisplayInfoProvider::~DisplayInfoProvider() {}
-
+// static
DisplayInfoProvider* DisplayInfoProvider::Get() {
if (g_display_info_provider == NULL)
- g_display_info_provider = new DisplayInfoProvider();
+ g_display_info_provider = DisplayInfoProvider::Create();
return g_display_info_provider;
}
+// static
void DisplayInfoProvider::InitializeForTesting(
DisplayInfoProvider* display_info_provider) {
DCHECK(display_info_provider);
@@ -86,4 +87,7 @@ DisplayInfo DisplayInfoProvider::GetAllDisplaysInfo() {
return all_displays;
}
+DisplayInfoProvider::DisplayInfoProvider() {
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698