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 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 // that the location bar view is visible and is considered focusable. If the | 1072 // that the location bar view is visible and is considered focusable. If the |
1073 // location bar view gains focus, |immersive_mode_controller_| will keep the | 1073 // location bar view gains focus, |immersive_mode_controller_| will keep the |
1074 // top-of-window views revealed. | 1074 // top-of-window views revealed. |
1075 scoped_ptr<ImmersiveRevealedLock> focus_reveal_lock( | 1075 scoped_ptr<ImmersiveRevealedLock> focus_reveal_lock( |
1076 immersive_mode_controller_->GetRevealedLock( | 1076 immersive_mode_controller_->GetRevealedLock( |
1077 ImmersiveModeController::ANIMATE_REVEAL_YES)); | 1077 ImmersiveModeController::ANIMATE_REVEAL_YES)); |
1078 | 1078 |
1079 LocationBarView* location_bar = GetLocationBarView(); | 1079 LocationBarView* location_bar = GetLocationBarView(); |
1080 if (location_bar->omnibox_view()->IsFocusable()) { | 1080 if (location_bar->omnibox_view()->IsFocusable()) { |
1081 // Location bar got focus. | 1081 // Location bar got focus. |
1082 // | 1082 location_bar->FocusLocation(select_all); |
1083 // select_all is true when it's expected that the user may want to copy | |
1084 // the URL to the clipboard. If the URL is not being shown because the | |
1085 // origin chip is enabled, show it now to support the same functionality. | |
1086 if (select_all && | |
1087 location_bar->GetToolbarModel()->WouldOmitURLDueToOriginChip()) | |
1088 location_bar->ShowURL(); | |
1089 else | |
1090 location_bar->FocusLocation(select_all); | |
1091 } else { | 1083 } else { |
1092 // If none of location bar got focus, then clear focus. | 1084 // If none of location bar got focus, then clear focus. |
1093 views::FocusManager* focus_manager = GetFocusManager(); | 1085 views::FocusManager* focus_manager = GetFocusManager(); |
1094 DCHECK(focus_manager); | 1086 DCHECK(focus_manager); |
1095 focus_manager->ClearFocus(); | 1087 focus_manager->ClearFocus(); |
1096 } | 1088 } |
1097 } | 1089 } |
1098 | 1090 |
1099 void BrowserView::UpdateReloadStopState(bool is_loading, bool force) { | 1091 void BrowserView::UpdateReloadStopState(bool is_loading, bool force) { |
1100 toolbar_->reload_button()->ChangeMode( | 1092 toolbar_->reload_button()->ChangeMode( |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2561 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2570 gfx::Point icon_bottom( | 2562 gfx::Point icon_bottom( |
2571 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2563 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2572 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2564 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2573 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); | 2565 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); |
2574 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2566 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2575 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2567 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2576 } | 2568 } |
2577 return top_arrow_height; | 2569 return top_arrow_height; |
2578 } | 2570 } |
OLD | NEW |