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

Side by Side Diff: chrome/browser/ui/views/page_info_bubble_view.cc

Issue 10826126: Show the leading Section headline text in PageInfoBubbleView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set the selection range in Layout. Created 8 years, 4 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 | Annotate | Revision Log
« 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/views/page_info_bubble_view.h" 5 #include "chrome/browser/ui/views/page_info_bubble_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/certificate_viewer.h" 10 #include "chrome/browser/certificate_viewer.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
13 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
14 #include "chrome/browser/ui/views/toolbar_view.h" 14 #include "chrome/browser/ui/views/toolbar_view.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "content/public/browser/cert_store.h" 16 #include "content/public/browser/cert_store.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/ssl_status.h" 18 #include "content/public/common/ssl_status.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "grit/locale_settings.h" 20 #include "grit/locale_settings.h"
21 #include "net/base/x509_certificate.h" 21 #include "net/base/x509_certificate.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/range/range.h"
23 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
24 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
25 #include "ui/views/controls/image_view.h" 26 #include "ui/views/controls/image_view.h"
26 #include "ui/views/controls/label.h" 27 #include "ui/views/controls/label.h"
27 #include "ui/views/controls/link.h" 28 #include "ui/views/controls/link.h"
28 #include "ui/views/controls/separator.h" 29 #include "ui/views/controls/separator.h"
29 #include "ui/views/layout/grid_layout.h" 30 #include "ui/views/layout/grid_layout.h"
30 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
31 32
32 using content::OpenURLParams; 33 using content::OpenURLParams;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 x += size.width() + kHGapImageToDescription; 418 x += size.width() + kHGapImageToDescription;
418 int w = width - x - kTextPaddingRight; 419 int w = width - x - kTextPaddingRight;
419 y = kVGapToHeadline; 420 y = kVGapToHeadline;
420 int headline_height = 0; 421 int headline_height = 0;
421 if (!headline_label_->text().empty()) { 422 if (!headline_label_->text().empty()) {
422 size = headline_label_->GetPreferredSize(); 423 size = headline_label_->GetPreferredSize();
423 headline_height = size.height(); 424 headline_height = size.height();
424 if (!compute_bounds_only) 425 if (!compute_bounds_only)
425 headline_label_->SetBounds(x, y, w > 0 ? w : 0, size.height()); 426 headline_label_->SetBounds(x, y, w > 0 ? w : 0, size.height());
426 y += size.height(); 427 y += size.height();
428
429 // Show the leading headline text by moving the textfield cursor there,
430 // otherwise long headlines may initially show the leading text truncated.
431 // This can only be done after the textfield is initialized with the Widget.
432 if (GetWidget())
433 headline_label_->SelectRange(ui::Range());
Peter Kasting 2012/08/03 19:20:37 I don't think this is the right fix. Instead, the
msw 2012/08/03 20:10:19 This fixes the regression and brings us to parity
427 } else { 434 } else {
428 if (!compute_bounds_only) 435 if (!compute_bounds_only)
429 headline_label_->SetBounds(x, y, 0, 0); 436 headline_label_->SetBounds(x, y, 0, 0);
430 } 437 }
431 if (w > 0) { 438 if (w > 0) {
432 int height = description_label_->GetHeightForWidth(w); 439 int height = description_label_->GetHeightForWidth(w);
433 if (headline_height == 0 && height < image_height) { 440 if (headline_height == 0 && height < image_height) {
434 // Descriptions without headlines that take up less space vertically than 441 // Descriptions without headlines that take up less space vertically than
435 // the image, should center align against the image. 442 // the image, should center align against the image.
436 y = status_image_->y() + (image_height - height) / 2; 443 y = status_image_->y() + (image_height - height) / 2;
(...skipping 29 matching lines...) Expand all
466 web_contents, 473 web_contents,
467 url, 474 url,
468 ssl, 475 ssl,
469 show_history, 476 show_history,
470 navigator); 477 navigator);
471 views::BubbleDelegateView::CreateBubble(page_info_bubble); 478 views::BubbleDelegateView::CreateBubble(page_info_bubble);
472 page_info_bubble->Show(); 479 page_info_bubble->Show();
473 } 480 }
474 481
475 } // namespace chrome 482 } // namespace chrome
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