diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 22:21:11 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 22:21:11 +0000 |
commit | 1172ba7af32d7756a138b2f5d4761cb8d566f29c (patch) | |
tree | c3623ce6a47f09e08f664ed961eb28a654dd4d12 /chrome/browser/views/browser_actions_container.cc | |
parent | f1c74ecbdfbe62d62668bdbeb7639284f0b455f4 (diff) | |
download | chromium_src-1172ba7af32d7756a138b2f5d4761cb8d566f29c.zip chromium_src-1172ba7af32d7756a138b2f5d4761cb8d566f29c.tar.gz chromium_src-1172ba7af32d7756a138b2f5d4761cb8d566f29c.tar.bz2 |
Ensure that the default profile for cros has no extension service
BUG=chromeium-os:3232
TEST=LoginProfileTest.UserNotPassed
Review URL: http://codereview.chromium.org/2094018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/browser_actions_container.cc')
-rw-r--r-- | chrome/browser/views/browser_actions_container.cc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index 2103108..c99e867 100644 --- a/chrome/browser/views/browser_actions_container.cc +++ b/chrome/browser/views/browser_actions_container.cc @@ -373,9 +373,10 @@ BrowserActionsContainer::BrowserActionsContainer( ALLOW_THIS_IN_INITIALIZER_LIST(show_menu_task_factory_(this)) { SetID(VIEW_ID_BROWSER_ACTION_TOOLBAR); - model_ = profile_->GetExtensionsService()->toolbar_model(); - model_->AddObserver(this); - + if (profile_->GetExtensionsService()) { + model_ = profile_->GetExtensionsService()->toolbar_model(); + model_->AddObserver(this); + } resize_animation_.reset(new SlideAnimation(this)); resize_gripper_ = new views::ResizeGripper(this); resize_gripper_->SetAccessibleName( @@ -402,12 +403,14 @@ BrowserActionsContainer::BrowserActionsContainer( profile_->GetPrefs()->GetInteger(prefs::kBrowserActionContainerWidth); if (predefined_width != 0) { int icon_width = (kButtonSize + kBrowserActionButtonPadding); - model_->SetVisibleIconCount( - (predefined_width - WidthOfNonIconArea()) / icon_width); + if (model_) { + model_->SetVisibleIconCount( + (predefined_width - WidthOfNonIconArea()) / icon_width); + } } } - if (model_->extensions_initialized()) + if (model_ && model_->extensions_initialized()) SetContainerWidth(); SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_EXTENSIONS)); @@ -486,6 +489,9 @@ void BrowserActionsContainer::SetDropIndicator(int x_pos) { void BrowserActionsContainer::CreateBrowserActionViews() { DCHECK(browser_action_views_.empty()); + if (!model_) + return; + for (ExtensionList::iterator iter = model_->begin(); iter != model_->end(); ++iter) { if (!ShouldDisplayBrowserAction(*iter)) @@ -783,6 +789,7 @@ int BrowserActionsContainer::OnPerformDrop( // Make sure we have the same view as we started with. DCHECK(browser_action_views_[data.index()]->button()->extension()->id() == data.id()); + DCHECK(model_); Extension* dragging = browser_action_views_[data.index()]->button()->extension(); @@ -828,9 +835,11 @@ bool BrowserActionsContainer::GetAccessibleRole( void BrowserActionsContainer::MoveBrowserAction( const std::string& extension_id, size_t new_index) { ExtensionsService* service = profile_->GetExtensionsService(); - Extension* extension = service->GetExtensionById(extension_id, false); - model_->MoveBrowserAction(extension, new_index); - SchedulePaint(); + if (service) { + Extension* extension = service->GetExtensionById(extension_id, false); + model_->MoveBrowserAction(extension, new_index); + SchedulePaint(); + } } void BrowserActionsContainer::RunMenu(View* source, const gfx::Point& pt) { |