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

Side by Side Diff: chrome/browser/ui/cocoa/accelerators_cocoa.mm

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/cocoa/accelerators_cocoa.h" 5 #include "chrome/browser/ui/cocoa/accelerators_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 ui::Accelerator accelerator = 144 ui::Accelerator accelerator =
145 AcceleratorFromKeyCode(entry.key_code, entry.modifiers); 145 AcceleratorFromKeyCode(entry.key_code, entry.modifiers);
146 accelerator_vector_.push_back(accelerator); 146 accelerator_vector_.push_back(accelerator);
147 } 147 }
148 } 148 }
149 149
150 AcceleratorsCocoa::~AcceleratorsCocoa() {} 150 AcceleratorsCocoa::~AcceleratorsCocoa() {}
151 151
152 // static 152 // static
153 AcceleratorsCocoa* AcceleratorsCocoa::GetInstance() { 153 AcceleratorsCocoa* AcceleratorsCocoa::GetInstance() {
154 return Singleton<AcceleratorsCocoa>::get(); 154 return base::Singleton<AcceleratorsCocoa>::get();
155 } 155 }
156 156
157 const ui::Accelerator* AcceleratorsCocoa::GetAcceleratorForCommand( 157 const ui::Accelerator* AcceleratorsCocoa::GetAcceleratorForCommand(
158 int command_id) { 158 int command_id) {
159 AcceleratorMap::iterator it = accelerators_.find(command_id); 159 AcceleratorMap::iterator it = accelerators_.find(command_id);
160 if (it == accelerators_.end()) 160 if (it == accelerators_.end())
161 return NULL; 161 return NULL;
162 return &it->second; 162 return &it->second;
163 } 163 }
164 164
(...skipping 17 matching lines...) Expand all
182 NSUInteger mask = platform_accelerator->modifier_mask(); 182 NSUInteger mask = platform_accelerator->modifier_mask();
183 BOOL maskEqual = 183 BOOL maskEqual =
184 (mask == modifiers) || ((mask & (~NSShiftKeyMask)) == modifiers); 184 (mask == modifiers) || ((mask & (~NSShiftKeyMask)) == modifiers);
185 NSString* string = [NSString stringWithFormat:@"%C", shifted_character]; 185 NSString* string = [NSString stringWithFormat:@"%C", shifted_character];
186 if ([string isEqual:key_equivalent] && maskEqual) 186 if ([string isEqual:key_equivalent] && maskEqual)
187 return &*it; 187 return &*it;
188 } 188 }
189 189
190 return NULL; 190 return NULL;
191 } 191 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/accelerators_cocoa.h ('k') | chrome/browser/ui/find_bar/find_bar_state_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698