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

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

Issue 2820323002: [ObjC ARC] Converts ios/chrome/browser/ui/colors:colors to ARC. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/colors/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 5 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
6 6
7 #include "ios/web/public/web_thread.h" 7 #include "ios/web/public/web_thread.h"
8 8
9 #if !defined(__has_feature) || !__has_feature(objc_arc)
10 #error "This file requires ARC support."
11 #endif
12
9 @implementation MDCPalette (CrAdditions) 13 @implementation MDCPalette (CrAdditions)
10 14
11 namespace { 15 namespace {
12 static MDCPalette* g_bluePalette = nil; 16 static MDCPalette* g_bluePalette = nil;
13 static MDCPalette* g_redPalette = nil; 17 static MDCPalette* g_redPalette = nil;
14 static MDCPalette* g_greenPalette = nil; 18 static MDCPalette* g_greenPalette = nil;
15 static MDCPalette* g_yellowPalette = nil; 19 static MDCPalette* g_yellowPalette = nil;
16 } 20 }
17 21
18 + (MDCPalette*)cr_bluePalette { 22 + (MDCPalette*)cr_bluePalette {
(...skipping 24 matching lines...) Expand all
43 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || 47 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
44 web::WebThread::CurrentlyOn(web::WebThread::UI)); 48 web::WebThread::CurrentlyOn(web::WebThread::UI));
45 if (!g_yellowPalette) 49 if (!g_yellowPalette)
46 return [MDCPalette yellowPalette]; 50 return [MDCPalette yellowPalette];
47 return g_yellowPalette; 51 return g_yellowPalette;
48 } 52 }
49 53
50 + (void)cr_setBluePalette:(MDCPalette*)palette { 54 + (void)cr_setBluePalette:(MDCPalette*)palette {
51 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || 55 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
52 web::WebThread::CurrentlyOn(web::WebThread::UI)); 56 web::WebThread::CurrentlyOn(web::WebThread::UI));
53 [g_bluePalette autorelease]; 57 g_bluePalette = palette;
54 g_bluePalette = [palette retain];
55 } 58 }
56 59
57 + (void)cr_setRedPalette:(MDCPalette*)palette { 60 + (void)cr_setRedPalette:(MDCPalette*)palette {
58 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || 61 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
59 web::WebThread::CurrentlyOn(web::WebThread::UI)); 62 web::WebThread::CurrentlyOn(web::WebThread::UI));
60 [g_redPalette autorelease]; 63 g_redPalette = palette;
61 g_redPalette = [palette retain];
62 } 64 }
63 65
64 + (void)cr_setGreenPalette:(MDCPalette*)palette { 66 + (void)cr_setGreenPalette:(MDCPalette*)palette {
65 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || 67 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
66 web::WebThread::CurrentlyOn(web::WebThread::UI)); 68 web::WebThread::CurrentlyOn(web::WebThread::UI));
67 [g_greenPalette autorelease]; 69 g_greenPalette = palette;
68 g_greenPalette = [palette retain];
69 } 70 }
70 71
71 + (void)cr_setYellowPalette:(MDCPalette*)palette { 72 + (void)cr_setYellowPalette:(MDCPalette*)palette {
72 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || 73 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
73 web::WebThread::CurrentlyOn(web::WebThread::UI)); 74 web::WebThread::CurrentlyOn(web::WebThread::UI));
74 [g_yellowPalette autorelease]; 75 g_yellowPalette = palette;
75 g_yellowPalette = [palette retain];
76 } 76 }
77 77
78 @end 78 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/colors/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698