| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/views/find_bar_win.h" | 5 #include "chrome/browser/views/find_bar_win.h" |
| 6 | 6 |
| 7 #include "app/slide_animation.h" | 7 #include "app/slide_animation.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/find_bar_controller.h" | 10 #include "chrome/browser/find_bar_controller.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // Initialize the host. | 96 // Initialize the host. |
| 97 host_.reset(new Host(this)); | 97 host_.reset(new Host(this)); |
| 98 host_->Init(browser_view->GetWidget()->GetNativeView(), gfx::Rect()); | 98 host_->Init(browser_view->GetWidget()->GetNativeView(), gfx::Rect()); |
| 99 host_->SetContentsView(view_); | 99 host_->SetContentsView(view_); |
| 100 | 100 |
| 101 // Start listening to focus changes, so we can register and unregister our | 101 // Start listening to focus changes, so we can register and unregister our |
| 102 // own handler for Escape. | 102 // own handler for Escape. |
| 103 focus_manager_ = | 103 focus_manager_ = |
| 104 views::FocusManager::GetFocusManagerForNativeView(host_->GetNativeView()); | 104 views::FocusManager::GetFocusManagerForNativeView(host_->GetNativeView()); |
| 105 focus_manager_->AddFocusChangeListener(this); | 105 if (focus_manager_) { |
| 106 focus_manager_->AddFocusChangeListener(this); |
| 106 | 107 |
| 107 // Stores the currently focused view, and tracks focus changes so that we can | 108 // Stores the currently focused view, and tracks focus changes so that we |
| 108 // restore focus when the find box is closed. | 109 // can restore focus when the find box is closed. |
| 109 focus_tracker_.reset(new views::ExternalFocusTracker(view_, focus_manager_)); | 110 focus_tracker_.reset(new views::ExternalFocusTracker(view_, |
| 111 focus_manager_)); |
| 112 } else { |
| 113 // In some cases (see bug http://crbug.com/17056) it seems we may not have |
| 114 // a focus manager. Please reopen the bug if you hit this. |
| 115 NOTREACHED(); |
| 116 } |
| 110 | 117 |
| 111 // Start the process of animating the opening of the window. | 118 // Start the process of animating the opening of the window. |
| 112 animation_.reset(new SlideAnimation(this)); | 119 animation_.reset(new SlideAnimation(this)); |
| 113 } | 120 } |
| 114 | 121 |
| 115 FindBarWin::~FindBarWin() { | 122 FindBarWin::~FindBarWin() { |
| 116 } | 123 } |
| 117 | 124 |
| 118 // TODO(brettw) this should not be so complicated. The view should really be in | 125 // TODO(brettw) this should not be so complicated. The view should really be in |
| 119 // charge of these regions. CustomFrameWindow will do this for us. It will also | 126 // charge of these regions. CustomFrameWindow will do this for us. It will also |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 focus_tracker_.reset(NULL); | 620 focus_tracker_.reset(NULL); |
| 614 } | 621 } |
| 615 | 622 |
| 616 void FindBarWin::AudibleAlert() { | 623 void FindBarWin::AudibleAlert() { |
| 617 #if defined(OS_WIN) | 624 #if defined(OS_WIN) |
| 618 MessageBeep(MB_OK); | 625 MessageBeep(MB_OK); |
| 619 #else | 626 #else |
| 620 NOTIMPLEMENTED(); | 627 NOTIMPLEMENTED(); |
| 621 #endif | 628 #endif |
| 622 } | 629 } |
| OLD | NEW |