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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 1909263002: Replace safe-bool idiom with explicit WeakPtr::operator bool() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
index 01ba00ba045fb9eb1dbde307ede30415b3bb7976..261cad7e783e198e0149fe97e560f0146d6047fe 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -51,7 +51,7 @@ OmniboxPopupView* OmniboxPopupContentsView::Create(
OmniboxView* omnibox_view,
OmniboxEditModel* edit_model,
LocationBarView* location_bar_view) {
- OmniboxPopupContentsView* view = NULL;
+ OmniboxPopupContentsView* view = nullptr;
view = new OmniboxPopupContentsView(
font_list, omnibox_view, edit_model, location_bar_view);
view->Init();
@@ -146,7 +146,7 @@ void OmniboxPopupContentsView::LayoutChildren() {
// OmniboxPopupContentsView, OmniboxPopupView overrides:
bool OmniboxPopupContentsView::IsOpen() const {
- return popup_ != NULL;
+ return !!popup_;
Nico 2016/06/02 21:31:02 no !! please
Wez 2016/06/02 21:48:06 Opted to use !! based on mmenke@'s points in comme
}
void OmniboxPopupContentsView::InvalidateLine(size_t line) {
@@ -167,7 +167,7 @@ void OmniboxPopupContentsView::UpdatePopupAppearance() {
if (model_->result().empty() || omnibox_view_->IsImeShowingPopup()) {
// No matches or the IME is showing a popup window which may overlap
// the omnibox popup window. Close any existing popup.
- if (popup_ != NULL) {
+ if (popup_) {
size_animation_.Stop();
// NOTE: Do NOT use CloseNow() here, as we may be deep in a callstack
@@ -237,7 +237,7 @@ void OmniboxPopupContentsView::UpdatePopupAppearance() {
size_animation_.Reset();
target_bounds_ = new_target_bounds;
- if (popup_ == NULL) {
+ if (!popup_) {
views::Widget* popup_parent = location_bar_view_->GetWidget();
// If the popup is currently closed, we need to create it.
@@ -260,12 +260,12 @@ void OmniboxPopupContentsView::UpdatePopupAppearance() {
// synchronously change focus/activation, resulting in the popup being
// destroyed by the time control returns here. Bail out in this case to
// avoid a NULL dereference.
- if (!popup_.get())
+ if (!popup_)
return;
popup_->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE);
popup_->SetContentsView(this);
popup_->StackAbove(omnibox_view_->GetRelativeWindowForPopup());
- if (!popup_.get()) {
+ if (!popup_) {
// For some IMEs GetRelativeWindowForPopup triggers the omnibox to lose
// focus, thereby closing (and destroying) the popup.
// TODO(sky): this won't be needed once we close the omnibox on input
@@ -328,7 +328,7 @@ bool OmniboxPopupContentsView::IsStarredMatch(
void OmniboxPopupContentsView::AnimationProgressed(
const gfx::Animation* animation) {
// We should only be running the animation when the popup is already visible.
- DCHECK(popup_ != NULL);
+ DCHECK(popup_);
popup_->SetBounds(GetPopupBounds());
}
@@ -346,7 +346,7 @@ void OmniboxPopupContentsView::Layout() {
views::View* OmniboxPopupContentsView::GetTooltipHandlerForPoint(
const gfx::Point& point) {
- return NULL;
+ return nullptr;
}
bool OmniboxPopupContentsView::OnMousePressed(

Powered by Google App Engine
This is Rietveld 408576698