OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "browser_actions_controller.h" | 5 #import "browser_actions_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 if (window != browser_->window()->GetNativeWindow()) | 206 if (window != browser_->window()->GetNativeWindow()) |
207 break; | 207 break; |
208 ExtensionService* service = browser_->profile()->GetExtensionService(); | 208 ExtensionService* service = browser_->profile()->GetExtensionService(); |
209 if (!service) | 209 if (!service) |
210 break; | 210 break; |
211 const Extension* extension = service->GetExtensionById(extension_id, | 211 const Extension* extension = service->GetExtensionById(extension_id, |
212 false); | 212 false); |
213 if (!extension) | 213 if (!extension) |
214 break; | 214 break; |
215 BrowserActionButton* button = [owner_ buttonForExtension:extension]; | 215 BrowserActionButton* button = [owner_ buttonForExtension:extension]; |
216 [owner_ browserActionClicked:button]; | 216 // |button| can be NULL when the browser action has its button hidden. |
Scott Hess - ex-Googler
2012/08/17 17:13:17
s/NULL/nil/ for Objective-C objects. Unless Brows
| |
217 if (button) | |
218 [owner_ browserActionClicked:button]; | |
Scott Hess - ex-Googler
2012/08/17 17:13:17
This combination almost makes me wish you could wr
Finnur
2012/08/20 11:41:45
Yeah, it is a bit silly because the function actua
Finnur
2012/08/20 14:03:34
Actually, I take that back (and reverted this chan
Scott Hess - ex-Googler
2012/08/20 22:59:34
Makes sense (I think).
On 2012/08/20 14:03:34, Fi
| |
217 break; | 219 break; |
218 } | 220 } |
219 default: | 221 default: |
220 NOTREACHED() << L"Unexpected notification"; | 222 NOTREACHED() << L"Unexpected notification"; |
221 } | 223 } |
222 } | 224 } |
223 | 225 |
224 // ExtensionToolbarModel::Observer implementation. | 226 // ExtensionToolbarModel::Observer implementation. |
225 void BrowserActionAdded(const Extension* extension, int index) { | 227 void BrowserActionAdded(const Extension* extension, int index) { |
226 [owner_ createActionButtonForExtension:extension withIndex:index]; | 228 [owner_ createActionButtonForExtension:extension withIndex:index]; |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
860 const extensions::ExtensionList& toolbar_items = | 862 const extensions::ExtensionList& toolbar_items = |
861 toolbarModel_->toolbar_items(); | 863 toolbarModel_->toolbar_items(); |
862 if (index < toolbar_items.size()) { | 864 if (index < toolbar_items.size()) { |
863 const Extension* extension = toolbar_items[index]; | 865 const Extension* extension = toolbar_items[index]; |
864 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 866 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
865 } | 867 } |
866 return nil; | 868 return nil; |
867 } | 869 } |
868 | 870 |
869 @end | 871 @end |
OLD | NEW |