| OLD | NEW |
| 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/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 keyword_hint_view_->SetFont(font_); | 268 keyword_hint_view_->SetFont(font_); |
| 269 | 269 |
| 270 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 270 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| 271 ContentSettingImageView* content_blocked_view = | 271 ContentSettingImageView* content_blocked_view = |
| 272 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); | 272 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); |
| 273 content_setting_views_.push_back(content_blocked_view); | 273 content_setting_views_.push_back(content_blocked_view); |
| 274 AddChildView(content_blocked_view); | 274 AddChildView(content_blocked_view); |
| 275 content_blocked_view->SetVisible(false); | 275 content_blocked_view->SetVisible(false); |
| 276 } | 276 } |
| 277 | 277 |
| 278 zoom_view_ = new ZoomView(model_); | 278 zoom_view_ = new ZoomView(model_, delegate_); |
| 279 AddChildView(zoom_view_); | 279 AddChildView(zoom_view_); |
| 280 | 280 |
| 281 if (extensions::switch_utils::IsActionBoxEnabled()) { | 281 if (extensions::switch_utils::IsActionBoxEnabled()) { |
| 282 action_box_button_view_ = new ActionBoxButtonView( | 282 action_box_button_view_ = new ActionBoxButtonView( |
| 283 extensions::ExtensionSystem::Get(profile_)->extension_service()); | 283 extensions::ExtensionSystem::Get(profile_)->extension_service()); |
| 284 AddChildView(action_box_button_view_); | 284 AddChildView(action_box_button_view_); |
| 285 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { | 285 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { |
| 286 // Note: condition above means that the star and ChromeToMobile icons are | 286 // Note: condition above means that the star and ChromeToMobile icons are |
| 287 // hidden in popups and in the app launcher. | 287 // hidden in popups and in the app launcher. |
| 288 star_view_ = new StarView(command_updater_); | 288 star_view_ = new StarView(command_updater_); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 526 |
| 527 void LocationBarView::SetZoomIconState( | 527 void LocationBarView::SetZoomIconState( |
| 528 ZoomController::ZoomIconState zoom_icon_state) { | 528 ZoomController::ZoomIconState zoom_icon_state) { |
| 529 zoom_view_->SetZoomIconState(zoom_icon_state); | 529 zoom_view_->SetZoomIconState(zoom_icon_state); |
| 530 | 530 |
| 531 Layout(); | 531 Layout(); |
| 532 SchedulePaint(); | 532 SchedulePaint(); |
| 533 } | 533 } |
| 534 | 534 |
| 535 void LocationBarView::ShowZoomBubble(int zoom_percent) { | 535 void LocationBarView::ShowZoomBubble(int zoom_percent) { |
| 536 ZoomBubbleView::ShowBubble(zoom_view_, zoom_percent, true); | 536 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); |
| 537 } | 537 } |
| 538 | 538 |
| 539 void LocationBarView::ShowChromeToMobileBubble() { | 539 void LocationBarView::ShowChromeToMobileBubble() { |
| 540 Browser* browser = GetBrowserFromDelegate(delegate_); | 540 Browser* browser = GetBrowserFromDelegate(delegate_); |
| 541 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); | 541 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); |
| 542 } | 542 } |
| 543 | 543 |
| 544 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 544 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
| 545 gfx::Point origin(location_entry_view_->bounds().origin()); | 545 gfx::Point origin(location_entry_view_->bounds().origin()); |
| 546 // If the UI layout is RTL, the coordinate system is not transformed and | 546 // If the UI layout is RTL, the coordinate system is not transformed and |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 void LocationBarView::OnSetFocus() { | 1067 void LocationBarView::OnSetFocus() { |
| 1068 views::FocusManager* focus_manager = GetFocusManager(); | 1068 views::FocusManager* focus_manager = GetFocusManager(); |
| 1069 if (!focus_manager) { | 1069 if (!focus_manager) { |
| 1070 NOTREACHED(); | 1070 NOTREACHED(); |
| 1071 return; | 1071 return; |
| 1072 } | 1072 } |
| 1073 focus_manager->SetFocusedView(view_to_focus_); | 1073 focus_manager->SetFocusedView(view_to_focus_); |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 SkBitmap LocationBarView::GetFavicon() const { | 1076 SkBitmap LocationBarView::GetFavicon() const { |
| 1077 return delegate_->GetTabContents()->favicon_tab_helper()->GetFavicon(); | 1077 return GetTabContents()->favicon_tab_helper()->GetFavicon(); |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 string16 LocationBarView::GetTitle() const { | 1080 string16 LocationBarView::GetTitle() const { |
| 1081 return GetWebContentsFromDelegate(delegate_)->GetTitle(); | 1081 return GetWebContentsFromDelegate(delegate_)->GetTitle(); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 InstantController* LocationBarView::GetInstant() { | 1084 InstantController* LocationBarView::GetInstant() { |
| 1085 return delegate_->GetInstant(); | 1085 return delegate_->GetInstant(); |
| 1086 } | 1086 } |
| 1087 | 1087 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 bool LocationBarView::HasFocus() const { | 1296 bool LocationBarView::HasFocus() const { |
| 1297 return location_entry_->model()->has_focus(); | 1297 return location_entry_->model()->has_focus(); |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 void LocationBarView::WriteDragDataForView(views::View* sender, | 1300 void LocationBarView::WriteDragDataForView(views::View* sender, |
| 1301 const gfx::Point& press_pt, | 1301 const gfx::Point& press_pt, |
| 1302 OSExchangeData* data) { | 1302 OSExchangeData* data) { |
| 1303 DCHECK_NE(GetDragOperationsForView(sender, press_pt), | 1303 DCHECK_NE(GetDragOperationsForView(sender, press_pt), |
| 1304 ui::DragDropTypes::DRAG_NONE); | 1304 ui::DragDropTypes::DRAG_NONE); |
| 1305 | 1305 |
| 1306 TabContents* tab_contents = delegate_->GetTabContents(); | 1306 TabContents* tab_contents = GetTabContents(); |
| 1307 DCHECK(tab_contents); | 1307 DCHECK(tab_contents); |
| 1308 button_drag_utils::SetURLAndDragImage( | 1308 button_drag_utils::SetURLAndDragImage( |
| 1309 tab_contents->web_contents()->GetURL(), | 1309 tab_contents->web_contents()->GetURL(), |
| 1310 tab_contents->web_contents()->GetTitle(), | 1310 tab_contents->web_contents()->GetTitle(), |
| 1311 tab_contents->favicon_tab_helper()->GetFavicon(), | 1311 tab_contents->favicon_tab_helper()->GetFavicon(), |
| 1312 data, | 1312 data, |
| 1313 sender->GetWidget()); | 1313 sender->GetWidget()); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 int LocationBarView::GetDragOperationsForView(views::View* sender, | 1316 int LocationBarView::GetDragOperationsForView(views::View* sender, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 } | 1526 } |
| 1527 | 1527 |
| 1528 void LocationBarView::CleanupFadeAnimation() { | 1528 void LocationBarView::CleanupFadeAnimation() { |
| 1529 // Since we're no longer animating we don't need our layer. | 1529 // Since we're no longer animating we don't need our layer. |
| 1530 SetPaintToLayer(false); | 1530 SetPaintToLayer(false); |
| 1531 // Bubble labels don't need a transparent background anymore. | 1531 // Bubble labels don't need a transparent background anymore. |
| 1532 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1532 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1533 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1533 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1534 } | 1534 } |
| 1535 #endif // USE_AURA | 1535 #endif // USE_AURA |
| OLD | NEW |