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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 keyword_hint_view_->SetFont(font_); | 263 keyword_hint_view_->SetFont(font_); |
264 | 264 |
265 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 265 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
266 ContentSettingImageView* content_blocked_view = | 266 ContentSettingImageView* content_blocked_view = |
267 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); | 267 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); |
268 content_setting_views_.push_back(content_blocked_view); | 268 content_setting_views_.push_back(content_blocked_view); |
269 AddChildView(content_blocked_view); | 269 AddChildView(content_blocked_view); |
270 content_blocked_view->SetVisible(false); | 270 content_blocked_view->SetVisible(false); |
271 } | 271 } |
272 | 272 |
273 zoom_view_ = new ZoomView(model_); | 273 zoom_view_ = new ZoomView(model_, delegate_); |
274 AddChildView(zoom_view_); | 274 AddChildView(zoom_view_); |
275 | 275 |
276 if (extensions::switch_utils::IsActionBoxEnabled()) { | 276 if (extensions::switch_utils::IsActionBoxEnabled()) { |
277 action_box_button_view_ = new ActionBoxButtonView( | 277 action_box_button_view_ = new ActionBoxButtonView( |
278 extensions::ExtensionSystem::Get(profile_)->extension_service()); | 278 extensions::ExtensionSystem::Get(profile_)->extension_service()); |
279 AddChildView(action_box_button_view_); | 279 AddChildView(action_box_button_view_); |
280 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { | 280 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { |
281 // Note: condition above means that the star and ChromeToMobile icons are | 281 // Note: condition above means that the star and ChromeToMobile icons are |
282 // hidden in popups and in the app launcher. | 282 // hidden in popups and in the app launcher. |
283 star_view_ = new StarView(command_updater_); | 283 star_view_ = new StarView(command_updater_); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 void LocationBarView::SetZoomIconState( | 509 void LocationBarView::SetZoomIconState( |
510 ZoomController::ZoomIconState zoom_icon_state) { | 510 ZoomController::ZoomIconState zoom_icon_state) { |
511 zoom_view_->SetZoomIconState(zoom_icon_state); | 511 zoom_view_->SetZoomIconState(zoom_icon_state); |
512 | 512 |
513 Layout(); | 513 Layout(); |
514 SchedulePaint(); | 514 SchedulePaint(); |
515 } | 515 } |
516 | 516 |
517 void LocationBarView::ShowZoomBubble(int zoom_percent) { | 517 void LocationBarView::ShowZoomBubble(int zoom_percent) { |
518 ZoomBubbleView::ShowBubble(zoom_view_, zoom_percent, true); | 518 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); |
519 } | 519 } |
520 | 520 |
521 void LocationBarView::ShowChromeToMobileBubble() { | 521 void LocationBarView::ShowChromeToMobileBubble() { |
522 Browser* browser = GetBrowserFromDelegate(delegate_); | 522 Browser* browser = GetBrowserFromDelegate(delegate_); |
523 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); | 523 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); |
524 } | 524 } |
525 | 525 |
526 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 526 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
527 gfx::Point origin(location_entry_view_->bounds().origin()); | 527 gfx::Point origin(location_entry_view_->bounds().origin()); |
528 // If the UI layout is RTL, the coordinate system is not transformed and | 528 // If the UI layout is RTL, the coordinate system is not transformed and |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 void LocationBarView::OnSetFocus() { | 1038 void LocationBarView::OnSetFocus() { |
1039 views::FocusManager* focus_manager = GetFocusManager(); | 1039 views::FocusManager* focus_manager = GetFocusManager(); |
1040 if (!focus_manager) { | 1040 if (!focus_manager) { |
1041 NOTREACHED(); | 1041 NOTREACHED(); |
1042 return; | 1042 return; |
1043 } | 1043 } |
1044 focus_manager->SetFocusedView(view_to_focus_); | 1044 focus_manager->SetFocusedView(view_to_focus_); |
1045 } | 1045 } |
1046 | 1046 |
1047 SkBitmap LocationBarView::GetFavicon() const { | 1047 SkBitmap LocationBarView::GetFavicon() const { |
1048 return delegate_->GetTabContents()->favicon_tab_helper()->GetFavicon(); | 1048 return GetTabContents()->favicon_tab_helper()->GetFavicon(); |
1049 } | 1049 } |
1050 | 1050 |
1051 string16 LocationBarView::GetTitle() const { | 1051 string16 LocationBarView::GetTitle() const { |
1052 return GetWebContentsFromDelegate(delegate_)->GetTitle(); | 1052 return GetWebContentsFromDelegate(delegate_)->GetTitle(); |
1053 } | 1053 } |
1054 | 1054 |
1055 InstantController* LocationBarView::GetInstant() { | 1055 InstantController* LocationBarView::GetInstant() { |
1056 return delegate_->GetInstant(); | 1056 return delegate_->GetInstant(); |
1057 } | 1057 } |
1058 | 1058 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 bool LocationBarView::HasFocus() const { | 1265 bool LocationBarView::HasFocus() const { |
1266 return location_entry_->model()->has_focus(); | 1266 return location_entry_->model()->has_focus(); |
1267 } | 1267 } |
1268 | 1268 |
1269 void LocationBarView::WriteDragDataForView(views::View* sender, | 1269 void LocationBarView::WriteDragDataForView(views::View* sender, |
1270 const gfx::Point& press_pt, | 1270 const gfx::Point& press_pt, |
1271 OSExchangeData* data) { | 1271 OSExchangeData* data) { |
1272 DCHECK_NE(GetDragOperationsForView(sender, press_pt), | 1272 DCHECK_NE(GetDragOperationsForView(sender, press_pt), |
1273 ui::DragDropTypes::DRAG_NONE); | 1273 ui::DragDropTypes::DRAG_NONE); |
1274 | 1274 |
1275 TabContents* tab_contents = delegate_->GetTabContents(); | 1275 TabContents* tab_contents = GetTabContents(); |
1276 DCHECK(tab_contents); | 1276 DCHECK(tab_contents); |
1277 button_drag_utils::SetURLAndDragImage( | 1277 button_drag_utils::SetURLAndDragImage( |
1278 tab_contents->web_contents()->GetURL(), | 1278 tab_contents->web_contents()->GetURL(), |
1279 tab_contents->web_contents()->GetTitle(), | 1279 tab_contents->web_contents()->GetTitle(), |
1280 tab_contents->favicon_tab_helper()->GetFavicon(), | 1280 tab_contents->favicon_tab_helper()->GetFavicon(), |
1281 data, | 1281 data, |
1282 sender->GetWidget()); | 1282 sender->GetWidget()); |
1283 } | 1283 } |
1284 | 1284 |
1285 int LocationBarView::GetDragOperationsForView(views::View* sender, | 1285 int LocationBarView::GetDragOperationsForView(views::View* sender, |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 } | 1495 } |
1496 | 1496 |
1497 void LocationBarView::CleanupFadeAnimation() { | 1497 void LocationBarView::CleanupFadeAnimation() { |
1498 // Since we're no longer animating we don't need our layer. | 1498 // Since we're no longer animating we don't need our layer. |
1499 SetPaintToLayer(false); | 1499 SetPaintToLayer(false); |
1500 // Bubble labels don't need a transparent background anymore. | 1500 // Bubble labels don't need a transparent background anymore. |
1501 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1501 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1502 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1502 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1503 } | 1503 } |
1504 #endif // USE_AURA | 1504 #endif // USE_AURA |
OLD | NEW |