| OLD | NEW |
| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 &chromium_url_rect_ : &open_source_url_rect_; | 400 &chromium_url_rect_ : &open_source_url_rect_; |
| 401 gfx::Rect* rect2 = chromium_url_appears_first_ ? | 401 gfx::Rect* rect2 = chromium_url_appears_first_ ? |
| 402 &open_source_url_rect_ : &chromium_url_rect_; | 402 &open_source_url_rect_ : &chromium_url_rect_; |
| 403 | 403 |
| 404 // This struct keeps track of where to write the next word (which x,y | 404 // This struct keeps track of where to write the next word (which x,y |
| 405 // pixel coordinate). This struct is updated after drawing text and checking | 405 // pixel coordinate). This struct is updated after drawing text and checking |
| 406 // if we need to wrap. | 406 // if we need to wrap. |
| 407 gfx::Size position; | 407 gfx::Size position; |
| 408 // Draw the first text chunk and position the Chromium url. | 408 // Draw the first text chunk and position the Chromium url. |
| 409 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, | 409 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, |
| 410 UTF16ToWideHack(main_label_chunk1_), link1, rect1, &position, | 410 main_label_chunk1_, link1, rect1, &position, |
| 411 text_direction_is_rtl_, label_bounds, font); | 411 text_direction_is_rtl_, label_bounds, font); |
| 412 // Draw the second text chunk and position the Open Source url. | 412 // Draw the second text chunk and position the Open Source url. |
| 413 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, | 413 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, |
| 414 UTF16ToWideHack(main_label_chunk2_), link2, rect2, &position, | 414 main_label_chunk2_, link2, rect2, &position, |
| 415 text_direction_is_rtl_, label_bounds, font); | 415 text_direction_is_rtl_, label_bounds, font); |
| 416 // Draw the third text chunk (which has no URL associated with it). | 416 // Draw the third text chunk (which has no URL associated with it). |
| 417 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, | 417 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, |
| 418 UTF16ToWideHack(main_label_chunk3_), NULL, NULL, &position, | 418 main_label_chunk3_, NULL, NULL, &position, |
| 419 text_direction_is_rtl_, label_bounds, font); | 419 text_direction_is_rtl_, label_bounds, font); |
| 420 | 420 |
| 421 #if defined(GOOGLE_CHROME_BUILD) | 421 #if defined(GOOGLE_CHROME_BUILD) |
| 422 // Insert a line break and some whitespace. | 422 // Insert a line break and some whitespace. |
| 423 position.set_width(0); | 423 position.set_width(0); |
| 424 position.Enlarge(0, font.GetHeight() + views::kRelatedControlVerticalSpacing); | 424 position.Enlarge(0, font.GetHeight() + views::kRelatedControlVerticalSpacing); |
| 425 | 425 |
| 426 // And now the Terms of Service and position the TOS url. | 426 // And now the Terms of Service and position the TOS url. |
| 427 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, | 427 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, |
| 428 UTF16ToWideHack(main_label_chunk4_), terms_of_service_url_, | 428 main_label_chunk4_, terms_of_service_url_, |
| 429 &terms_of_service_url_rect_, &position, text_direction_is_rtl_, | 429 &terms_of_service_url_rect_, &position, text_direction_is_rtl_, |
| 430 label_bounds, font); | 430 label_bounds, font); |
| 431 // The last text chunk doesn't have a URL associated with it. | 431 // The last text chunk doesn't have a URL associated with it. |
| 432 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, | 432 view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, |
| 433 UTF16ToWideHack(main_label_chunk5_), NULL, NULL, &position, | 433 main_label_chunk5_, NULL, NULL, &position, |
| 434 text_direction_is_rtl_, label_bounds, font); | 434 text_direction_is_rtl_, label_bounds, font); |
| 435 | 435 |
| 436 // Position the TOS URL within the main label. | 436 // Position the TOS URL within the main label. |
| 437 terms_of_service_url_->SetBounds(terms_of_service_url_rect_.x(), | 437 terms_of_service_url_->SetBounds(terms_of_service_url_rect_.x(), |
| 438 terms_of_service_url_rect_.y(), | 438 terms_of_service_url_rect_.y(), |
| 439 terms_of_service_url_rect_.width(), | 439 terms_of_service_url_rect_.width(), |
| 440 terms_of_service_url_rect_.height()); | 440 terms_of_service_url_rect_.height()); |
| 441 #endif | 441 #endif |
| 442 | 442 |
| 443 // Position the URLs within the main label. First position the Chromium URL | 443 // Position the URLs within the main label. First position the Chromium URL |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 // We have updated controls on the parent, so we need to update its layout. | 726 // We have updated controls on the parent, so we need to update its layout. |
| 727 parent()->Layout(); | 727 parent()->Layout(); |
| 728 | 728 |
| 729 // Check button may have appeared/disappeared. We cannot call this during | 729 // Check button may have appeared/disappeared. We cannot call this during |
| 730 // ViewHierarchyChanged because the view hasn't been added to a Widget yet. | 730 // ViewHierarchyChanged because the view hasn't been added to a Widget yet. |
| 731 if (GetWidget()) | 731 if (GetWidget()) |
| 732 GetDialogClientView()->UpdateDialogButtons(); | 732 GetDialogClientView()->UpdateDialogButtons(); |
| 733 } | 733 } |
| 734 | 734 |
| 735 #endif | 735 #endif |
| OLD | NEW |