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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 bool LocationBarView::HasFocus() const { | 1297 bool LocationBarView::HasFocus() const { |
1298 return location_entry_->model()->has_focus(); | 1298 return location_entry_->model()->has_focus(); |
1299 } | 1299 } |
1300 | 1300 |
1301 void LocationBarView::WriteDragDataForView(views::View* sender, | 1301 void LocationBarView::WriteDragDataForView(views::View* sender, |
1302 const gfx::Point& press_pt, | 1302 const gfx::Point& press_pt, |
1303 OSExchangeData* data) { | 1303 OSExchangeData* data) { |
1304 DCHECK_NE(GetDragOperationsForView(sender, press_pt), | 1304 DCHECK_NE(GetDragOperationsForView(sender, press_pt), |
1305 ui::DragDropTypes::DRAG_NONE); | 1305 ui::DragDropTypes::DRAG_NONE); |
1306 | 1306 |
1307 TabContents* tab_contents = delegate_->GetTabContents(); | 1307 TabContents* tab_contents = GetTabContents(); |
1308 DCHECK(tab_contents); | 1308 DCHECK(tab_contents); |
1309 gfx::ImageSkia favicon = | 1309 gfx::ImageSkia favicon = |
1310 tab_contents->favicon_tab_helper()->GetFavicon().AsImageSkia(); | 1310 tab_contents->favicon_tab_helper()->GetFavicon().AsImageSkia(); |
1311 button_drag_utils::SetURLAndDragImage( | 1311 button_drag_utils::SetURLAndDragImage( |
1312 tab_contents->web_contents()->GetURL(), | 1312 tab_contents->web_contents()->GetURL(), |
1313 tab_contents->web_contents()->GetTitle(), | 1313 tab_contents->web_contents()->GetTitle(), |
1314 favicon, | 1314 favicon, |
1315 data, | 1315 data, |
1316 sender->GetWidget()); | 1316 sender->GetWidget()); |
1317 } | 1317 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 } | 1529 } |
1530 | 1530 |
1531 void LocationBarView::CleanupFadeAnimation() { | 1531 void LocationBarView::CleanupFadeAnimation() { |
1532 // Since we're no longer animating we don't need our layer. | 1532 // Since we're no longer animating we don't need our layer. |
1533 SetPaintToLayer(false); | 1533 SetPaintToLayer(false); |
1534 // Bubble labels don't need a transparent background anymore. | 1534 // Bubble labels don't need a transparent background anymore. |
1535 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1535 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1536 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1536 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1537 } | 1537 } |
1538 #endif // USE_AURA | 1538 #endif // USE_AURA |
OLD | NEW |