OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/location_bar_view.h" | 5 #include "chrome/browser/views/location_bar_view.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/app/theme/theme_resources.h" | 10 #include "chrome/app/theme/theme_resources.h" |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 flags |= MK_CONTROL; | 569 flags |= MK_CONTROL; |
570 if (event.IsShiftDown()) | 570 if (event.IsShiftDown()) |
571 flags |= MK_SHIFT; | 571 flags |= MK_SHIFT; |
572 if (event.IsLeftMouseButton()) | 572 if (event.IsLeftMouseButton()) |
573 flags |= MK_LBUTTON; | 573 flags |= MK_LBUTTON; |
574 if (event.IsMiddleMouseButton()) | 574 if (event.IsMiddleMouseButton()) |
575 flags |= MK_MBUTTON; | 575 flags |= MK_MBUTTON; |
576 if (event.IsRightMouseButton()) | 576 if (event.IsRightMouseButton()) |
577 flags |= MK_RBUTTON; | 577 flags |= MK_RBUTTON; |
578 | 578 |
579 CPoint screen_point(event.x(), event.y()); | 579 gfx::Point screen_point(event.location()); |
580 ConvertPointToScreen(this, &screen_point); | 580 ConvertPointToScreen(this, &screen_point); |
581 | 581 |
582 location_entry_->HandleExternalMsg(msg, flags, screen_point); | 582 location_entry_->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); |
583 } | 583 } |
584 | 584 |
585 bool LocationBarView::GetAccessibleRole(VARIANT* role) { | 585 bool LocationBarView::GetAccessibleRole(VARIANT* role) { |
586 DCHECK(role); | 586 DCHECK(role); |
587 | 587 |
588 role->vt = VT_I4; | 588 role->vt = VT_I4; |
589 role->lVal = ROLE_SYSTEM_GROUPING; | 589 role->lVal = ROLE_SYSTEM_GROUPING; |
590 return true; | 590 return true; |
591 } | 591 } |
592 | 592 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 | 867 |
868 void LocationBarView::ShowFirstRunBubbleInternal() { | 868 void LocationBarView::ShowFirstRunBubbleInternal() { |
869 if (!location_entry_view_) | 869 if (!location_entry_view_) |
870 return; | 870 return; |
871 if (!location_entry_view_->GetViewContainer()->IsActive()) { | 871 if (!location_entry_view_->GetViewContainer()->IsActive()) { |
872 // The browser is no longer active. Let's not show the info bubble, this | 872 // The browser is no longer active. Let's not show the info bubble, this |
873 // would make the browser the active window again. | 873 // would make the browser the active window again. |
874 return; | 874 return; |
875 } | 875 } |
876 | 876 |
877 CPoint location(0, 0); | 877 gfx::Point location; |
878 | 878 |
879 // If the UI layout is RTL, the coordinate system is not transformed and | 879 // If the UI layout is RTL, the coordinate system is not transformed and |
880 // therefore we need to adjust the X coordinate so that bubble appears on the | 880 // therefore we need to adjust the X coordinate so that bubble appears on the |
881 // right hand side of the location bar. | 881 // right hand side of the location bar. |
882 if (UILayoutIsRightToLeft()) | 882 if (UILayoutIsRightToLeft()) |
883 location.x += width(); | 883 location.Offset(width(), 0); |
884 ChromeViews::View::ConvertPointToScreen(this, &location); | 884 ChromeViews::View::ConvertPointToScreen(this, &location); |
885 | 885 |
886 // We try to guess that 20 pixels offset is a good place for the first | 886 // We try to guess that 20 pixels offset is a good place for the first |
887 // letter in the OmniBox. | 887 // letter in the OmniBox. |
888 gfx::Rect bounds(location.x, location.y, 20, height()); | 888 gfx::Rect bounds(location.x(), location.y(), 20, height()); |
889 | 889 |
890 // Moving the bounds "backwards" so that it appears within the location bar | 890 // Moving the bounds "backwards" so that it appears within the location bar |
891 // if the UI layout is RTL. | 891 // if the UI layout is RTL. |
892 if (UILayoutIsRightToLeft()) | 892 if (UILayoutIsRightToLeft()) |
893 bounds.set_x(location.x - 20); | 893 bounds.set_x(location.x() - 20); |
894 | 894 |
895 FirstRunBubble::Show( | 895 FirstRunBubble::Show( |
896 location_entry_view_->GetRootView()->GetViewContainer()->GetHWND(), | 896 location_entry_view_->GetRootView()->GetViewContainer()->GetHWND(), |
897 bounds); | 897 bounds); |
898 } | 898 } |
899 | 899 |
900 void LocationBarView::ShowFirstRunBubble() { | 900 void LocationBarView::ShowFirstRunBubble() { |
901 // We wait 30 milliseconds to open. It allows less flicker. | 901 // We wait 30 milliseconds to open. It allows less flicker. |
902 Task* task = first_run_bubble_.NewRunnableMethod( | 902 Task* task = first_run_bubble_.NewRunnableMethod( |
903 &LocationBarView::ShowFirstRunBubbleInternal); | 903 &LocationBarView::ShowFirstRunBubbleInternal); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 NOTREACHED(); | 947 NOTREACHED(); |
948 break; | 948 break; |
949 } | 949 } |
950 } | 950 } |
951 | 951 |
952 void LocationBarView::SecurityImageView::ShowInfoBubble() { | 952 void LocationBarView::SecurityImageView::ShowInfoBubble() { |
953 std::wstring text; | 953 std::wstring text; |
954 SkColor text_color; | 954 SkColor text_color; |
955 model_->GetIconHoverText(&text, &text_color); | 955 model_->GetIconHoverText(&text, &text_color); |
956 | 956 |
957 CPoint location(0, 0); | 957 gfx::Point location; |
958 ChromeViews::View::ConvertPointToScreen(this, &location); | 958 ChromeViews::View::ConvertPointToScreen(this, &location); |
959 gfx::Rect bounds(location.x, location.y, width(), height()); | 959 gfx::Rect bounds(location.x(), location.y(), width(), height()); |
960 | 960 |
961 ChromeViews::Label* label = new ChromeViews::Label(text); | 961 ChromeViews::Label* label = new ChromeViews::Label(text); |
962 label->SetMultiLine(true); | 962 label->SetMultiLine(true); |
963 label->SetColor(text_color); | 963 label->SetColor(text_color); |
964 label->SetFont(ResourceBundle::GetSharedInstance().GetFont( | 964 label->SetFont(ResourceBundle::GetSharedInstance().GetFont( |
965 ResourceBundle::BaseFont).DeriveFont(2)); | 965 ResourceBundle::BaseFont).DeriveFont(2)); |
966 label->SetHorizontalAlignment(ChromeViews::Label::ALIGN_LEFT); | 966 label->SetHorizontalAlignment(ChromeViews::Label::ALIGN_LEFT); |
967 label->SizeToFit(0); | 967 label->SizeToFit(0); |
968 DCHECK(info_bubble_ == NULL); | 968 DCHECK(info_bubble_ == NULL); |
969 info_bubble_ = InfoBubble::Show(GetRootView()->GetViewContainer()->GetHWND(), | 969 info_bubble_ = InfoBubble::Show(GetRootView()->GetViewContainer()->GetHWND(), |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 void LocationBarView::SecurityImageView::InfoBubbleClosing( | 1018 void LocationBarView::SecurityImageView::InfoBubbleClosing( |
1019 InfoBubble* info_bubble) { | 1019 InfoBubble* info_bubble) { |
1020 info_bubble_ = NULL; | 1020 info_bubble_ = NULL; |
1021 } | 1021 } |
1022 | 1022 |
1023 bool LocationBarView::OverrideAccelerator( | 1023 bool LocationBarView::OverrideAccelerator( |
1024 const ChromeViews::Accelerator& accelerator) { | 1024 const ChromeViews::Accelerator& accelerator) { |
1025 return location_entry_->OverrideAccelerator(accelerator); | 1025 return location_entry_->OverrideAccelerator(accelerator); |
1026 } | 1026 } |
1027 | 1027 |
OLD | NEW |