| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/compact_location_bar_host.h" | 5 #include "chrome/browser/chromeos/compact_location_bar_host.h" |
| 6 | 6 |
| 7 #include <algorithm> |
| 8 |
| 7 #include "app/slide_animation.h" | 9 #include "app/slide_animation.h" |
| 8 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| 9 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/chromeos/compact_location_bar_view.h" | 13 #include "chrome/browser/chromeos/compact_location_bar_view.h" |
| 12 #include "chrome/browser/find_bar_controller.h" | 14 #include "chrome/browser/find_bar_controller.h" |
| 13 #include "chrome/browser/renderer_host/render_view_host.h" | 15 #include "chrome/browser/renderer_host/render_view_host.h" |
| 14 #include "chrome/browser/tab_contents/tab_contents.h" | 16 #include "chrome/browser/tab_contents/tab_contents.h" |
| 15 #include "chrome/browser/tab_contents/tab_contents_view.h" | 17 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 16 #include "chrome/browser/view_ids.h" | 18 #include "chrome/browser/view_ids.h" |
| 17 #include "chrome/browser/views/bookmark_bar_view.h" | 19 #include "chrome/browser/views/bookmark_bar_view.h" |
| 18 #include "chrome/browser/views/find_bar_view.h" | 20 #include "chrome/browser/views/find_bar_view.h" |
| 19 #include "chrome/browser/views/frame/browser_view.h" | 21 #include "chrome/browser/views/frame/browser_view.h" |
| 20 #include "chrome/browser/views/tabs/tab.h" | 22 #include "chrome/browser/views/tabs/tab.h" |
| 21 #include "chrome/browser/views/tabs/tab_strip.h" | 23 #include "chrome/browser/views/tabs/tab_strip.h" |
| 24 #include "chrome/browser/views/toolbar_star_toggle.h" |
| 22 #include "views/controls/scrollbar/native_scroll_bar.h" | 25 #include "views/controls/scrollbar/native_scroll_bar.h" |
| 23 #include "views/focus/external_focus_tracker.h" | 26 #include "views/focus/external_focus_tracker.h" |
| 24 #include "views/focus/view_storage.h" | 27 #include "views/focus/view_storage.h" |
| 25 #include "views/widget/root_view.h" | 28 #include "views/widget/root_view.h" |
| 26 #include "views/widget/widget.h" | 29 #include "views/widget/widget.h" |
| 27 | 30 |
| 28 namespace chromeos { | 31 namespace chromeos { |
| 29 const int kDefaultLocationBarWidth = 300; | 32 const int kDefaultLocationBarWidth = 300; |
| 30 const int kHideTimeoutInSeconds = 2; | 33 const int kHideTimeoutInSeconds = 2; |
| 31 | 34 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 254 } |
| 252 | 255 |
| 253 void CompactLocationBarHost::SetEnabled(bool enabled) { | 256 void CompactLocationBarHost::SetEnabled(bool enabled) { |
| 254 if (enabled) { | 257 if (enabled) { |
| 255 browser_view()->browser()->tabstrip_model()->AddObserver(this); | 258 browser_view()->browser()->tabstrip_model()->AddObserver(this); |
| 256 } else { | 259 } else { |
| 257 browser_view()->browser()->tabstrip_model()->RemoveObserver(this); | 260 browser_view()->browser()->tabstrip_model()->RemoveObserver(this); |
| 258 } | 261 } |
| 259 } | 262 } |
| 260 | 263 |
| 264 ToolbarStarToggle* CompactLocationBarHost::GetStarButton() { |
| 265 return GetClbView()->star_button(); |
| 266 } |
| 267 |
| 261 void CompactLocationBarHost::Show(bool a) { | 268 void CompactLocationBarHost::Show(bool a) { |
| 262 MessageLoopForUI::current()->AddObserver(mouse_observer_.get()); | 269 MessageLoopForUI::current()->AddObserver(mouse_observer_.get()); |
| 263 DropdownBarHost::Show(a); | 270 DropdownBarHost::Show(a); |
| 264 } | 271 } |
| 265 | 272 |
| 266 void CompactLocationBarHost::Hide(bool a) { | 273 void CompactLocationBarHost::Hide(bool a) { |
| 267 MessageLoopForUI::current()->RemoveObserver(mouse_observer_.get()); | 274 MessageLoopForUI::current()->RemoveObserver(mouse_observer_.get()); |
| 268 DropdownBarHost::Hide(a); | 275 DropdownBarHost::Hide(a); |
| 269 } | 276 } |
| 270 | 277 |
| 271 //////////////////////////////////////////////////////////////////////////////// | 278 //////////////////////////////////////////////////////////////////////////////// |
| 272 // CompactLocationBarHost private: | 279 // CompactLocationBarHost private: |
| 273 | 280 |
| 274 CompactLocationBarView* CompactLocationBarHost::GetClbView() { | 281 CompactLocationBarView* CompactLocationBarHost::GetClbView() { |
| 275 return static_cast<CompactLocationBarView*>(view()); | 282 return static_cast<CompactLocationBarView*>(view()); |
| 276 } | 283 } |
| 277 | 284 |
| 278 bool CompactLocationBarHost::IsCurrentTabIndex(int index) { | 285 bool CompactLocationBarHost::IsCurrentTabIndex(int index) { |
| 279 return current_tab_index_ == index; | 286 return current_tab_index_ == index; |
| 280 } | 287 } |
| 281 | 288 |
| 282 } // namespace chromeos | 289 } // namespace chromeos |
| OLD | NEW |