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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 if (profile_->IsOffTheRecord()) | 827 if (profile_->IsOffTheRecord()) |
828 index = toolbarModel_->IncognitoIndexToOriginal(index); | 828 index = toolbarModel_->IncognitoIndexToOriginal(index); |
829 if (index < toolbarModel_->size()) { | 829 if (index < toolbarModel_->size()) { |
830 const Extension* extension = toolbarModel_->GetExtensionByIndex(index); | 830 const Extension* extension = toolbarModel_->GetExtensionByIndex(index); |
831 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 831 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
832 } | 832 } |
833 return nil; | 833 return nil; |
834 } | 834 } |
835 | 835 |
836 @end | 836 @end |
OLD | NEW |