| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 // that the location bar view is visible and is considered focusable. If the | 1071 // that the location bar view is visible and is considered focusable. If the |
| 1072 // location bar view gains focus, |immersive_mode_controller_| will keep the | 1072 // location bar view gains focus, |immersive_mode_controller_| will keep the |
| 1073 // top-of-window views revealed. | 1073 // top-of-window views revealed. |
| 1074 scoped_ptr<ImmersiveRevealedLock> focus_reveal_lock( | 1074 scoped_ptr<ImmersiveRevealedLock> focus_reveal_lock( |
| 1075 immersive_mode_controller_->GetRevealedLock( | 1075 immersive_mode_controller_->GetRevealedLock( |
| 1076 ImmersiveModeController::ANIMATE_REVEAL_YES)); | 1076 ImmersiveModeController::ANIMATE_REVEAL_YES)); |
| 1077 | 1077 |
| 1078 LocationBarView* location_bar = GetLocationBarView(); | 1078 LocationBarView* location_bar = GetLocationBarView(); |
| 1079 if (location_bar->omnibox_view()->IsFocusable()) { | 1079 if (location_bar->omnibox_view()->IsFocusable()) { |
| 1080 // Location bar got focus. | 1080 // Location bar got focus. |
| 1081 // | 1081 location_bar->FocusLocation(select_all); |
| 1082 // select_all is true when it's expected that the user may want to copy | |
| 1083 // the URL to the clipboard. If the URL is not being shown because the | |
| 1084 // origin chip is enabled, show it now to support the same functionality. | |
| 1085 if (select_all && | |
| 1086 location_bar->GetToolbarModel()->WouldOmitURLDueToOriginChip()) | |
| 1087 location_bar->ShowURL(); | |
| 1088 else | |
| 1089 location_bar->FocusLocation(select_all); | |
| 1090 } else { | 1082 } else { |
| 1091 // If none of location bar got focus, then clear focus. | 1083 // If none of location bar got focus, then clear focus. |
| 1092 views::FocusManager* focus_manager = GetFocusManager(); | 1084 views::FocusManager* focus_manager = GetFocusManager(); |
| 1093 DCHECK(focus_manager); | 1085 DCHECK(focus_manager); |
| 1094 focus_manager->ClearFocus(); | 1086 focus_manager->ClearFocus(); |
| 1095 } | 1087 } |
| 1096 } | 1088 } |
| 1097 | 1089 |
| 1098 void BrowserView::UpdateReloadStopState(bool is_loading, bool force) { | 1090 void BrowserView::UpdateReloadStopState(bool is_loading, bool force) { |
| 1099 toolbar_->reload_button()->ChangeMode( | 1091 toolbar_->reload_button()->ChangeMode( |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2583 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2575 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2584 gfx::Point icon_bottom( | 2576 gfx::Point icon_bottom( |
| 2585 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2577 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2586 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2578 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2587 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); | 2579 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); |
| 2588 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2580 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2589 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2581 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2590 } | 2582 } |
| 2591 return top_arrow_height; | 2583 return top_arrow_height; |
| 2592 } | 2584 } |
| OLD | NEW |