| 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/search/toolbar_search_animator.h" | 5 #include "chrome/browser/ui/search/toolbar_search_animator.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/search/search_model.h" | 7 #include "chrome/browser/ui/search/search_model.h" |
| 8 #include "chrome/browser/ui/search/search_types.h" | 8 #include "chrome/browser/ui/search/search_types.h" |
| 9 #include "chrome/browser/ui/search/toolbar_search_animator_observer.h" | 9 #include "chrome/browser/ui/search/toolbar_search_animator_observer.h" |
| 10 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 10 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool ToolbarSearchAnimator::IsToolbarSeparatorVisible() const { | 49 bool ToolbarSearchAnimator::IsToolbarSeparatorVisible() const { |
| 50 // The toolbar separator is only visible in 2 scenarios: | 50 // The toolbar separator is only visible in 2 scenarios: |
| 51 // 1) when mode is |SEARCH_SUGGESTIONS|, user input is not in progress, and | 51 // 1) when mode is |SEARCH_SUGGESTIONS|, user input is not in progress, and |
| 52 // the omnibox popup has finished retracting before the navigation URL was | 52 // the omnibox popup has finished retracting before the navigation URL was |
| 53 // committed, i.e. before the mode was changed to |DEFAULT|. | 53 // committed, i.e. before the mode was changed to |DEFAULT|. |
| 54 // 2) when mode is |DEFAULT| and the omnibox popup has finished retracting. | 54 // 2) when mode is |DEFAULT| and the omnibox popup has finished retracting. |
| 55 return !is_omnibox_popup_open_ && | 55 return !is_omnibox_popup_open_ && |
| 56 ((search_model_->mode().mode == Mode::MODE_SEARCH_SUGGESTIONS && | 56 ((search_model_->mode().mode == Mode::MODE_SEARCH_SUGGESTIONS && |
| 57 !toolbar_model_->input_in_progress()) || | 57 !toolbar_model_->GetInputInProgress()) || |
| 58 search_model_->mode().is_default()); | 58 search_model_->mode().is_default()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void ToolbarSearchAnimator::OnOmniboxPopupClosed() { | 61 void ToolbarSearchAnimator::OnOmniboxPopupClosed() { |
| 62 is_omnibox_popup_open_ = false; | 62 is_omnibox_popup_open_ = false; |
| 63 FOR_EACH_OBSERVER(ToolbarSearchAnimatorObserver, observers_, | 63 FOR_EACH_OBSERVER(ToolbarSearchAnimatorObserver, observers_, |
| 64 OnToolbarSeparatorChanged()); | 64 OnToolbarSeparatorChanged()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void ToolbarSearchAnimator::FinishAnimation( | 67 void ToolbarSearchAnimator::FinishAnimation( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 // Notify observers of animation cancelation. | 155 // Notify observers of animation cancelation. |
| 156 if (notify_background_observers) { | 156 if (notify_background_observers) { |
| 157 FOR_EACH_OBSERVER(ToolbarSearchAnimatorObserver, observers_, | 157 FOR_EACH_OBSERVER(ToolbarSearchAnimatorObserver, observers_, |
| 158 OnToolbarBackgroundAnimatorCanceled(web_contents)); | 158 OnToolbarBackgroundAnimatorCanceled(web_contents)); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace search | 162 } // namespace search |
| 163 } // namespace chrome | 163 } // namespace chrome |
| OLD | NEW |