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

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

Issue 7280019: Fixes bug where clicks on 'ok' button in about dialog wouldn't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unneeded field Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/about_chrome_view.h" 5 #include "chrome/browser/ui/views/about_chrome_view.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <commdlg.h> 8 #include <commdlg.h>
9 #endif // defined(OS_WIN) 9 #endif // defined(OS_WIN)
10 10
(...skipping 15 matching lines...) Expand all
26 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
27 #include "chrome/installer/util/browser_distribution.h" 27 #include "chrome/installer/util/browser_distribution.h"
28 #include "content/browser/user_metrics.h" 28 #include "content/browser/user_metrics.h"
29 #include "grit/chromium_strings.h" 29 #include "grit/chromium_strings.h"
30 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
31 #include "grit/locale_settings.h" 31 #include "grit/locale_settings.h"
32 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
33 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
34 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
35 #include "ui/gfx/canvas.h" 35 #include "ui/gfx/canvas.h"
36 #include "views/controls/button/text_button.h"
36 #include "views/controls/link.h" 37 #include "views/controls/link.h"
37 #include "views/controls/textfield/textfield.h" 38 #include "views/controls/textfield/textfield.h"
38 #include "views/controls/throbber.h" 39 #include "views/controls/throbber.h"
39 #include "views/layout/layout_constants.h" 40 #include "views/layout/layout_constants.h"
40 #include "views/view_text_utils.h" 41 #include "views/view_text_utils.h"
41 #include "views/widget/widget.h" 42 #include "views/widget/widget.h"
42 #include "webkit/glue/webkit_glue.h" 43 #include "webkit/glue/webkit_glue.h"
43 44
44 #if defined(OS_WIN) 45 #if defined(OS_WIN)
45 #include "base/win/win_util.h" 46 #include "base/win/win_util.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // This image is hidden (see ViewHierarchyChanged) and displayed on demand. 395 // This image is hidden (see ViewHierarchyChanged) and displayed on demand.
395 sz = update_available_indicator_.GetPreferredSize(); 396 sz = update_available_indicator_.GetPreferredSize();
396 update_available_indicator_.SetBounds(throbber_topleft_x, throbber_topleft_y, 397 update_available_indicator_.SetBounds(throbber_topleft_x, throbber_topleft_y,
397 sz.width(), sz.height()); 398 sz.width(), sz.height());
398 399
399 // This image is hidden (see ViewHierarchyChanged) and displayed on demand. 400 // This image is hidden (see ViewHierarchyChanged) and displayed on demand.
400 sz = timeout_indicator_.GetPreferredSize(); 401 sz = timeout_indicator_.GetPreferredSize();
401 timeout_indicator_.SetBounds(throbber_topleft_x, throbber_topleft_y, 402 timeout_indicator_.SetBounds(throbber_topleft_x, throbber_topleft_y,
402 sz.width(), sz.height()); 403 sz.width(), sz.height());
403 404
404 // The update label should be at the bottom of the screen, to the right of 405 // The update label should be at the bottom of the screen, to the right of the
405 // the throbber. We specify width to the end of the dialog because it contains 406 // throbber. It vertically lines up with the ok button, so we make sure it
406 // variable length messages. 407 // doesn't extend into the ok button.
407 sz = update_label_.GetPreferredSize(); 408 sz = update_label_.GetPreferredSize();
408 int update_label_x = throbber_->x() + throbber_->width() + 409 int update_label_x = throbber_->x() + throbber_->width() +
409 views::kRelatedControlHorizontalSpacing; 410 views::kRelatedControlHorizontalSpacing;
411 views::DialogClientView* dialog_client_view = GetDialogClientView();
412 int max_x = parent_bounds.width();
413 if (dialog_client_view->ok_button() &&
414 dialog_client_view->ok_button()->IsVisible()) {
415 max_x = std::min(dialog_client_view->ok_button()->x(), max_x);
416 }
417 if (dialog_client_view->cancel_button() &&
418 dialog_client_view->cancel_button()->IsVisible()) {
419 max_x = std::min(dialog_client_view->cancel_button()->x(), max_x);
420 }
410 update_label_.SetHorizontalAlignment(views::Label::ALIGN_LEFT); 421 update_label_.SetHorizontalAlignment(views::Label::ALIGN_LEFT);
411 update_label_.SetBounds(update_label_x, 422 update_label_.SetBounds(update_label_x,
412 throbber_topleft_y + 1, 423 throbber_topleft_y + 1,
413 parent_bounds.width() - update_label_x, 424 std::min(max_x - update_label_x, sz.width()),
414 sz.height()); 425 sz.height());
415 } 426 }
416 427
417 void AboutChromeView::OnPaint(gfx::Canvas* canvas) { 428 void AboutChromeView::OnPaint(gfx::Canvas* canvas) {
418 views::View::OnPaint(canvas); 429 views::View::OnPaint(canvas);
419 430
420 // Draw the background image color (and the separator) across the dialog. 431 // Draw the background image color (and the separator) across the dialog.
421 // This will become the background for the logo image at the top of the 432 // This will become the background for the logo image at the top of the
422 // dialog. 433 // dialog.
423 canvas->TileImageInt(*kBackgroundBmp, 0, 0, 434 canvas->TileImageInt(*kBackgroundBmp, 0, 0,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 // We have updated controls on the parent, so we need to update its layout. 779 // We have updated controls on the parent, so we need to update its layout.
769 parent()->Layout(); 780 parent()->Layout();
770 781
771 // Check button may have appeared/disappeared. We cannot call this during 782 // Check button may have appeared/disappeared. We cannot call this during
772 // ViewHierarchyChanged because the view hasn't been added to a Widget yet. 783 // ViewHierarchyChanged because the view hasn't been added to a Widget yet.
773 if (GetWidget()) 784 if (GetWidget())
774 GetDialogClientView()->UpdateDialogButtons(); 785 GetDialogClientView()->UpdateDialogButtons();
775 } 786 }
776 787
777 #endif 788 #endif
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