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

Unified Diff: ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.mm

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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: ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.mm
diff --git a/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.mm b/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.mm
new file mode 100644
index 0000000000000000000000000000000000000000..2e2708e49800b482fcb32f5de048ca3732d86412
--- /dev/null
+++ b/ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.mm
@@ -0,0 +1,78 @@
+// Copyright 2016 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.
+
+#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
+
+#include "ios/web/public/web_thread.h"
+
+@implementation MDCPalette (CrAdditions)
+
+namespace {
+static MDCPalette* g_bluePalette = nil;
+static MDCPalette* g_redPalette = nil;
+static MDCPalette* g_greenPalette = nil;
+static MDCPalette* g_yellowPalette = nil;
+}
+
++ (MDCPalette*)cr_bluePalette {
+ DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
+ web::WebThread::CurrentlyOn(web::WebThread::UI));
+ if (!g_bluePalette)
+ return [MDCPalette bluePalette];
+ return g_bluePalette;
+}
+
++ (MDCPalette*)cr_redPalette {
+ DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
+ web::WebThread::CurrentlyOn(web::WebThread::UI));
+ if (!g_redPalette)
+ return [MDCPalette redPalette];
+ return g_redPalette;
+}
+
++ (MDCPalette*)cr_greenPalette {
+ DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
+ web::WebThread::CurrentlyOn(web::WebThread::UI));
+ if (!g_greenPalette)
+ return [MDCPalette greenPalette];
+ return g_greenPalette;
+}
+
++ (MDCPalette*)cr_yellowPalette {
+ DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
+ web::WebThread::CurrentlyOn(web::WebThread::UI));
+ if (!g_yellowPalette)
+ return [MDCPalette yellowPalette];
+ return g_yellowPalette;
+}
+
++ (void)cr_setBluePalette:(MDCPalette*)palette {
+ DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
+ web::WebThread::CurrentlyOn(web::WebThread::UI));
+ [g_bluePalette autorelease];
+ g_bluePalette = [palette retain];
+}
+
++ (void)cr_setRedPalette:(MDCPalette*)palette {
+ DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
+ web::WebThread::CurrentlyOn(web::WebThread::UI));
+ [g_redPalette autorelease];
+ g_redPalette = [palette retain];
+}
+
++ (void)cr_setGreenPalette:(MDCPalette*)palette {
+ DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
+ web::WebThread::CurrentlyOn(web::WebThread::UI));
+ [g_greenPalette autorelease];
+ g_greenPalette = [palette retain];
+}
+
++ (void)cr_setYellowPalette:(MDCPalette*)palette {
+ DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
+ web::WebThread::CurrentlyOn(web::WebThread::UI));
+ [g_yellowPalette autorelease];
+ g_yellowPalette = [palette retain];
+}
+
+@end
« no previous file with comments | « ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h ('k') | ios/chrome/browser/ui/contextual_search/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698