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

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: Add unit-test for comparison operators Created 4 years, 6 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 6abb037ea6a4393f6d0711f6e7dfec160a9d5193..1e79e0c2e9c271d36456e3a35d1d0914e97f192d 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();
@@ -141,7 +141,7 @@ void OmniboxPopupContentsView::LayoutChildren() {
// OmniboxPopupContentsView, OmniboxPopupView overrides:
bool OmniboxPopupContentsView::IsOpen() const {
- return popup_ != NULL;
+ return popup_ != nullptr;
}
void OmniboxPopupContentsView::InvalidateLine(size_t line) {
@@ -163,7 +163,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
@@ -233,7 +233,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.
@@ -256,12 +256,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
@@ -324,7 +324,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());
}
@@ -342,7 +342,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