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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 if ((self = [super init])) { | 232 if ((self = [super init])) { |
233 browser_ = browser; | 233 browser_ = browser; |
234 profile_ = browser->profile(); | 234 profile_ = browser->profile(); |
235 | 235 |
236 if (!profile_->GetPrefs()->FindPreference( | 236 if (!profile_->GetPrefs()->FindPreference( |
237 prefs::kBrowserActionContainerWidth)) | 237 prefs::kBrowserActionContainerWidth)) |
238 [BrowserActionsController registerUserPrefs:profile_->GetPrefs()]; | 238 [BrowserActionsController registerUserPrefs:profile_->GetPrefs()]; |
239 | 239 |
240 observer_.reset(new ExtensionServiceObserverBridge(self, profile_)); | 240 observer_.reset(new ExtensionServiceObserverBridge(self, profile_)); |
241 ExtensionService* extensionsService = profile_->GetExtensionService(); | 241 ExtensionService* extensionService = profile_->GetExtensionService(); |
242 // |extensionsService| can be NULL in Incognito. | 242 // |extensionService| can be NULL in Incognito. |
243 if (extensionsService) { | 243 if (extensionService) { |
244 toolbarModel_ = extensionsService->toolbar_model(); | 244 toolbarModel_ = extensionService->toolbar_model(); |
245 toolbarModel_->AddObserver(observer_.get()); | 245 toolbarModel_->AddObserver(observer_.get()); |
246 } | 246 } |
247 | 247 |
248 containerView_ = container; | 248 containerView_ = container; |
249 [containerView_ setPostsFrameChangedNotifications:YES]; | 249 [containerView_ setPostsFrameChangedNotifications:YES]; |
250 [[NSNotificationCenter defaultCenter] | 250 [[NSNotificationCenter defaultCenter] |
251 addObserver:self | 251 addObserver:self |
252 selector:@selector(containerFrameChanged:) | 252 selector:@selector(containerFrameChanged:) |
253 name:NSViewFrameDidChangeNotification | 253 name:NSViewFrameDidChangeNotification |
254 object:containerView_]; | 254 object:containerView_]; |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 const extensions::ExtensionList& toolbar_items = | 833 const extensions::ExtensionList& toolbar_items = |
834 toolbarModel_->toolbar_items(); | 834 toolbarModel_->toolbar_items(); |
835 if (index < toolbar_items.size()) { | 835 if (index < toolbar_items.size()) { |
836 const Extension* extension = toolbar_items[index]; | 836 const Extension* extension = toolbar_items[index]; |
837 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 837 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
838 } | 838 } |
839 return nil; | 839 return nil; |
840 } | 840 } |
841 | 841 |
842 @end | 842 @end |
OLD | NEW |