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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 // that the location bar view is visible and is considered focusable. If the | 1012 // that the location bar view is visible and is considered focusable. If the |
1013 // location bar view gains focus, |immersive_mode_controller_| will keep the | 1013 // location bar view gains focus, |immersive_mode_controller_| will keep the |
1014 // top-of-window views revealed. | 1014 // top-of-window views revealed. |
1015 scoped_ptr<ImmersiveRevealedLock> focus_reveal_lock( | 1015 scoped_ptr<ImmersiveRevealedLock> focus_reveal_lock( |
1016 immersive_mode_controller_->GetRevealedLock( | 1016 immersive_mode_controller_->GetRevealedLock( |
1017 ImmersiveModeController::ANIMATE_REVEAL_YES)); | 1017 ImmersiveModeController::ANIMATE_REVEAL_YES)); |
1018 | 1018 |
1019 LocationBarView* location_bar = GetLocationBarView(); | 1019 LocationBarView* location_bar = GetLocationBarView(); |
1020 if (location_bar->omnibox_view()->IsFocusable()) { | 1020 if (location_bar->omnibox_view()->IsFocusable()) { |
1021 // Location bar got focus. | 1021 // Location bar got focus. |
1022 // | 1022 location_bar->FocusLocation(select_all); |
1023 // select_all is true when it's expected that the user may want to copy | |
1024 // the URL to the clipboard. If the URL is not being shown because the | |
1025 // origin chip is enabled, show it now to support the same functionality. | |
1026 if (select_all && | |
1027 location_bar->GetToolbarModel()->WouldOmitURLDueToOriginChip()) | |
1028 location_bar->ShowURL(); | |
1029 else | |
1030 location_bar->FocusLocation(select_all); | |
1031 } else { | 1023 } else { |
1032 // If none of location bar got focus, then clear focus. | 1024 // If none of location bar got focus, then clear focus. |
1033 views::FocusManager* focus_manager = GetFocusManager(); | 1025 views::FocusManager* focus_manager = GetFocusManager(); |
1034 DCHECK(focus_manager); | 1026 DCHECK(focus_manager); |
1035 focus_manager->ClearFocus(); | 1027 focus_manager->ClearFocus(); |
1036 } | 1028 } |
1037 } | 1029 } |
1038 | 1030 |
1039 void BrowserView::UpdateReloadStopState(bool is_loading, bool force) { | 1031 void BrowserView::UpdateReloadStopState(bool is_loading, bool force) { |
1040 toolbar_->reload_button()->ChangeMode( | 1032 toolbar_->reload_button()->ChangeMode( |
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2518 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2527 gfx::Point icon_bottom( | 2519 gfx::Point icon_bottom( |
2528 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2520 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2529 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2521 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2530 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); | 2522 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); |
2531 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2523 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2532 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2524 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2533 } | 2525 } |
2534 return top_arrow_height; | 2526 return top_arrow_height; |
2535 } | 2527 } |
OLD | NEW |