Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate.cc

Issue 2693513002: ash: Fix clusterfuzz crash in AddShelfOptionsMenu (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 if (!shelf_delegate_) { 472 if (!shelf_delegate_) {
473 shelf_delegate_ = new ChromeLauncherControllerImpl(nullptr, model); 473 shelf_delegate_ = new ChromeLauncherControllerImpl(nullptr, model);
474 shelf_delegate_->Init(); 474 shelf_delegate_->Init();
475 } 475 }
476 return shelf_delegate_; 476 return shelf_delegate_;
477 } 477 }
478 478
479 ui::MenuModel* ChromeShellDelegate::CreateContextMenu( 479 ui::MenuModel* ChromeShellDelegate::CreateContextMenu(
480 ash::WmShelf* wm_shelf, 480 ash::WmShelf* wm_shelf,
481 const ash::ShelfItem* item) { 481 const ash::ShelfItem* item) {
482 DCHECK(shelf_delegate_);
483 // Don't show context menu for exclusive app runtime mode. 482 // Don't show context menu for exclusive app runtime mode.
484 if (chrome::IsRunningInAppMode()) 483 if (chrome::IsRunningInAppMode())
485 return nullptr; 484 return nullptr;
486 485
486 // No context menu before |shelf_delegate_| is created. This is possible
487 // now because CreateShelfDelegate is called by session state change
488 // via mojo asynchronously. Context menu could be triggered when the
489 // mojo message is still in-fly and crashes.
490 if (!shelf_delegate_)
491 return nullptr;
492
487 return LauncherContextMenu::Create(shelf_delegate_, item, wm_shelf); 493 return LauncherContextMenu::Create(shelf_delegate_, item, wm_shelf);
488 } 494 }
489 495
490 ash::GPUSupport* ChromeShellDelegate::CreateGPUSupport() { 496 ash::GPUSupport* ChromeShellDelegate::CreateGPUSupport() {
491 // Chrome uses real GPU support. 497 // Chrome uses real GPU support.
492 return new ash::GPUSupportImpl; 498 return new ash::GPUSupportImpl;
493 } 499 }
494 500
495 base::string16 ChromeShellDelegate::GetProductName() const { 501 base::string16 ChromeShellDelegate::GetProductName() const {
496 return l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); 502 return l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 NOTREACHED() << "Unexpected notification " << type; 600 NOTREACHED() << "Unexpected notification " << type;
595 } 601 }
596 } 602 }
597 603
598 void ChromeShellDelegate::PlatformInit() { 604 void ChromeShellDelegate::PlatformInit() {
599 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 605 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
600 content::NotificationService::AllSources()); 606 content::NotificationService::AllSources());
601 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, 607 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED,
602 content::NotificationService::AllSources()); 608 content::NotificationService::AllSources());
603 } 609 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698