Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 [owner_ browserActionVisibilityHasChanged]; | 274 [owner_ browserActionVisibilityHasChanged]; |
| 275 break; | 275 break; |
| 276 } | 276 } |
| 277 case NotificationType::EXTENSION_UNLOADED: | 277 case NotificationType::EXTENSION_UNLOADED: |
| 278 case NotificationType::EXTENSION_UNLOADED_DISABLED: { | 278 case NotificationType::EXTENSION_UNLOADED_DISABLED: { |
| 279 Extension* extension = Details<Extension>(details).ptr(); | 279 Extension* extension = Details<Extension>(details).ptr(); |
| 280 [owner_ removeActionButtonForExtension:extension]; | 280 [owner_ removeActionButtonForExtension:extension]; |
| 281 [owner_ browserActionVisibilityHasChanged]; | 281 [owner_ browserActionVisibilityHasChanged]; |
| 282 break; | 282 break; |
| 283 } | 283 } |
| 284 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: | 284 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { |
| 285 if (Details<ExtensionHost>([[owner_ popup] host]) != details) | 285 ExtensionPopupController* popup = [owner_ popup]; |
| 286 if (popup == nil || Details<ExtensionHost>([popup host]) != details) | |
|
Mark Mentovai
2009/12/21 20:54:32
Things are sometimes a tiny bit easier to follow i
Bons
2009/12/21 21:01:41
Done.
| |
| 286 return; | 287 return; |
| 288 | |
| 287 [owner_ hidePopup]; | 289 [owner_ hidePopup]; |
| 288 break; | 290 break; |
| 291 } | |
| 289 default: | 292 default: |
| 290 NOTREACHED() << L"Unexpected notification"; | 293 NOTREACHED() << L"Unexpected notification"; |
| 291 } | 294 } |
| 292 } | 295 } |
| 293 | 296 |
| 294 private: | 297 private: |
| 295 // The object we need to inform when we get a notification. Weak. Owns us. | 298 // The object we need to inform when we get a notification. Weak. Owns us. |
| 296 BrowserActionsController* owner_; | 299 BrowserActionsController* owner_; |
| 297 | 300 |
| 298 // Used for registering to receive notifications and automatic clean up. | 301 // Used for registering to receive notifications and automatic clean up. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 309 | 312 |
| 310 if ((self = [super init])) { | 313 if ((self = [super init])) { |
| 311 browser_ = browser; | 314 browser_ = browser; |
| 312 profile_ = browser->profile(); | 315 profile_ = browser->profile(); |
| 313 | 316 |
| 314 containerView_ = container; | 317 containerView_ = container; |
| 315 [containerView_ setHidden:YES]; | 318 [containerView_ setHidden:YES]; |
| 316 observer_.reset(new ExtensionsServiceObserverBridge(self, profile_)); | 319 observer_.reset(new ExtensionsServiceObserverBridge(self, profile_)); |
| 317 buttons_.reset([[NSMutableDictionary alloc] init]); | 320 buttons_.reset([[NSMutableDictionary alloc] init]); |
| 318 buttonOrder_.reset([[NSMutableArray alloc] init]); | 321 buttonOrder_.reset([[NSMutableArray alloc] init]); |
| 322 popupController_ = nil; | |
|
Mark Mentovai
2009/12/21 20:54:32
Not strictly necessary, because -alloc zero-fills
Bons
2009/12/21 21:01:41
Done.
| |
| 319 } | 323 } |
| 320 | 324 |
| 321 return self; | 325 return self; |
| 322 } | 326 } |
| 323 | 327 |
| 324 - (void)update { | 328 - (void)update { |
| 325 for (BrowserActionButton* button in [buttons_ allValues]) { | 329 for (BrowserActionButton* button in [buttons_ allValues]) { |
| 326 [button updateState]; | 330 [button updateState]; |
| 327 } | 331 } |
| 328 } | 332 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 return -1; | 461 return -1; |
| 458 | 462 |
| 459 return selected_tab->controller().session_id().id(); | 463 return selected_tab->controller().session_id().id(); |
| 460 } | 464 } |
| 461 | 465 |
| 462 - (NSButton*)buttonWithIndex:(int)index { | 466 - (NSButton*)buttonWithIndex:(int)index { |
| 463 return [buttonOrder_ objectAtIndex:(NSUInteger)index]; | 467 return [buttonOrder_ objectAtIndex:(NSUInteger)index]; |
| 464 } | 468 } |
| 465 | 469 |
| 466 @end | 470 @end |
| OLD | NEW |