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

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

Issue 275183002: patch from issue 218843002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 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 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/infobar_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // Ensure the infobar is tall enough to display its contents. 271 // Ensure the infobar is tall enough to display its contents.
272 const int kMinimumVerticalPadding = 6; 272 const int kMinimumVerticalPadding = 6;
273 int height = kDefaultBarTargetHeight; 273 int height = kDefaultBarTargetHeight;
274 for (int i = 0; i < child_count(); ++i) { 274 for (int i = 0; i < child_count(); ++i) {
275 const int child_height = child_at(i)->height(); 275 const int child_height = child_at(i)->height();
276 height = std::max(height, child_height + kMinimumVerticalPadding); 276 height = std::max(height, child_height + kMinimumVerticalPadding);
277 } 277 }
278 SetBarTargetHeight(height); 278 SetBarTargetHeight(height);
279 } 279 }
280 280
281 void InfoBarView::PaintChildren(gfx::Canvas* canvas) { 281 void InfoBarView::PaintChildren(gfx::Canvas* canvas,
282 const views::CullSet& cull_set) {
282 canvas->Save(); 283 canvas->Save();
283 284
284 // TODO(scr): This really should be the |fill_path_|, but the clipPath seems 285 // TODO(scr): This really should be the |fill_path_|, but the clipPath seems
285 // broken on non-Windows platforms (crbug.com/75154). For now, just clip to 286 // broken on non-Windows platforms (crbug.com/75154). For now, just clip to
286 // the bar bounds. 287 // the bar bounds.
287 // 288 //
288 // canvas->sk_canvas()->clipPath(fill_path_); 289 // canvas->sk_canvas()->clipPath(fill_path_);
289 DCHECK_EQ(total_height(), height()) 290 DCHECK_EQ(total_height(), height())
290 << "Infobar piecewise heights do not match overall height"; 291 << "Infobar piecewise heights do not match overall height";
291 canvas->ClipRect(gfx::Rect(0, arrow_height(), width(), bar_height())); 292 canvas->ClipRect(gfx::Rect(0, arrow_height(), width(), bar_height()));
292 views::View::PaintChildren(canvas); 293 views::View::PaintChildren(canvas, cull_set);
293 canvas->Restore(); 294 canvas->Restore();
294 } 295 }
295 296
296 void InfoBarView::ButtonPressed(views::Button* sender, 297 void InfoBarView::ButtonPressed(views::Button* sender,
297 const ui::Event& event) { 298 const ui::Event& event) {
298 if (!owner()) 299 if (!owner())
299 return; // We're closing; don't call anything, it might access the owner. 300 return; // We're closing; don't call anything, it might access the owner.
300 if (sender == close_button_) { 301 if (sender == close_button_) {
301 delegate()->InfoBarDismissed(); 302 delegate()->InfoBarDismissed();
302 RemoveSelf(); 303 RemoveSelf();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { 414 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) {
414 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); 415 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now);
415 416
416 // This will trigger some screen readers to read the entire contents of this 417 // This will trigger some screen readers to read the entire contents of this
417 // infobar. 418 // infobar.
418 if (focused_before && focused_now && !Contains(focused_before) && 419 if (focused_before && focused_now && !Contains(focused_before) &&
419 Contains(focused_now)) { 420 Contains(focused_now)) {
420 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 421 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
421 } 422 }
422 } 423 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_view.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698