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

Side by Side Diff: chrome/browser/ui/views/infobars/confirm_infobar.cc

Issue 941133002: Update global error bubble view's boundary (position and size) after loading elevation icon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/views/infobars/confirm_infobar.h" 5 #include "chrome/browser/ui/views/infobars/confirm_infobar.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/infobars/infobar_service.h" 8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "chrome/browser/ui/views/elevation_icon_setter.h" 9 #include "chrome/browser/ui/views/elevation_icon_setter.h"
10 #include "components/infobars/core/confirm_infobar_delegate.h" 10 #include "components/infobars/core/confirm_infobar_delegate.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const ViewHierarchyChangedDetails& details) { 64 const ViewHierarchyChangedDetails& details) {
65 if (details.is_add && details.child == this && (label_ == NULL)) { 65 if (details.is_add && details.child == this && (label_ == NULL)) {
66 ConfirmInfoBarDelegate* delegate = GetDelegate(); 66 ConfirmInfoBarDelegate* delegate = GetDelegate();
67 label_ = CreateLabel(delegate->GetMessageText()); 67 label_ = CreateLabel(delegate->GetMessageText());
68 AddChildView(label_); 68 AddChildView(label_);
69 69
70 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) { 70 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) {
71 ok_button_ = CreateLabelButton( 71 ok_button_ = CreateLabelButton(
72 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); 72 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
73 if (delegate->OKButtonTriggersUACPrompt()) 73 if (delegate->OKButtonTriggersUACPrompt())
74 elevation_icon_setter_.reset(new ElevationIconSetter(ok_button_)); 74 elevation_icon_setter_.reset(new ElevationIconSetter(
75 ok_button_,
76 base::Bind(&ConfirmInfoBar::Layout, base::Unretained(this))));
75 AddChildView(ok_button_); 77 AddChildView(ok_button_);
76 } 78 }
77 79
78 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) { 80 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) {
79 cancel_button_ = CreateLabelButton( 81 cancel_button_ = CreateLabelButton(
80 this, 82 this,
81 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)); 83 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
82 AddChildView(cancel_button_); 84 AddChildView(cancel_button_);
83 } 85 }
84 86
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 128 }
127 129
128 int ConfirmInfoBar::NonLabelWidth() const { 130 int ConfirmInfoBar::NonLabelWidth() const {
129 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 131 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
130 0 : kEndOfLabelSpacing; 132 0 : kEndOfLabelSpacing;
131 if (ok_button_) 133 if (ok_button_)
132 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 134 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
133 width += (cancel_button_ ? cancel_button_->width() : 0); 135 width += (cancel_button_ ? cancel_button_->width() : 0);
134 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 136 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
135 } 137 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/global_error_bubble_view.cc ('k') | chrome/browser/ui/views/outdated_upgrade_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698