OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/about_chrome_view.h" | 5 #include "chrome/browser/views/about_chrome_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // Create a label and add the full text so we can query it for the height. | 280 // Create a label and add the full text so we can query it for the height. |
281 views::Label dummy_text(full_text); | 281 views::Label dummy_text(full_text); |
282 dummy_text.SetMultiLine(true); | 282 dummy_text.SetMultiLine(true); |
283 gfx::Font font = | 283 gfx::Font font = |
284 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); | 284 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); |
285 | 285 |
286 // Add up the height of the various elements on the page. | 286 // Add up the height of the various elements on the page. |
287 int height = about_background_logo->height() + | 287 int height = about_background_logo->height() + |
288 kRelatedControlVerticalSpacing + | 288 kRelatedControlVerticalSpacing + |
289 // Copyright line. | 289 // Copyright line. |
290 font.height() + | 290 font.GetHeight() + |
291 // Main label. | 291 // Main label. |
292 dummy_text.GetHeightForWidth( | 292 dummy_text.GetHeightForWidth( |
293 dialog_dimensions_.width() - (2 * kPanelHorizMargin)) + | 293 dialog_dimensions_.width() - (2 * kPanelHorizMargin)) + |
294 kRelatedControlVerticalSpacing; | 294 kRelatedControlVerticalSpacing; |
295 | 295 |
296 #if defined(GOOGLE_CHROME_BUILD) | 296 #if defined(GOOGLE_CHROME_BUILD) |
297 std::vector<size_t> url_offsets; | 297 std::vector<size_t> url_offsets; |
298 text = l10n_util::GetStringF(IDS_ABOUT_TERMS_OF_SERVICE, | 298 text = l10n_util::GetStringF(IDS_ABOUT_TERMS_OF_SERVICE, |
299 std::wstring(), | 299 std::wstring(), |
300 std::wstring(), | 300 std::wstring(), |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 chromium_url_rect_.y(), | 490 chromium_url_rect_.y(), |
491 chromium_url_rect_.width(), | 491 chromium_url_rect_.width(), |
492 chromium_url_rect_.height()); | 492 chromium_url_rect_.height()); |
493 // Then position the Open Source URL within the main label. | 493 // Then position the Open Source URL within the main label. |
494 open_source_url_->SetBounds(open_source_url_rect_.x(), | 494 open_source_url_->SetBounds(open_source_url_rect_.x(), |
495 open_source_url_rect_.y(), | 495 open_source_url_rect_.y(), |
496 open_source_url_rect_.width(), | 496 open_source_url_rect_.width(), |
497 open_source_url_rect_.height()); | 497 open_source_url_rect_.height()); |
498 | 498 |
499 // Save the height so we can set the bounds correctly. | 499 // Save the height so we can set the bounds correctly. |
500 main_text_label_height_ = position.height() + font.height(); | 500 main_text_label_height_ = position.height() + font.GetHeight(); |
501 } | 501 } |
502 | 502 |
503 void AboutChromeView::ViewHierarchyChanged(bool is_add, | 503 void AboutChromeView::ViewHierarchyChanged(bool is_add, |
504 views::View* parent, | 504 views::View* parent, |
505 views::View* child) { | 505 views::View* child) { |
506 // Since we want some of the controls to show up in the same visual row | 506 // Since we want some of the controls to show up in the same visual row |
507 // as the buttons, which are provided by the framework, we must add the | 507 // as the buttons, which are provided by the framework, we must add the |
508 // buttons to the non-client view, which is the parent of this view. | 508 // buttons to the non-client view, which is the parent of this view. |
509 // Similarly, when we're removed from the view hierarchy, we must take care | 509 // Similarly, when we're removed from the view hierarchy, we must take care |
510 // to remove these items as well. | 510 // to remove these items as well. |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 View* parent = GetParent(); | 814 View* parent = GetParent(); |
815 parent->Layout(); | 815 parent->Layout(); |
816 | 816 |
817 // Check button may have appeared/disappeared. We cannot call this during | 817 // Check button may have appeared/disappeared. We cannot call this during |
818 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. | 818 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. |
819 if (window()) | 819 if (window()) |
820 GetDialogClientView()->UpdateDialogButtons(); | 820 GetDialogClientView()->UpdateDialogButtons(); |
821 } | 821 } |
822 | 822 |
823 #endif | 823 #endif |
OLD | NEW |