| 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/browser_instant_controller.h" | 5 #include "chrome/browser/ui/browser_instant_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_shutdown.h" | 7 #include "chrome/browser/browser_shutdown.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/instant/instant_controller.h" | 9 #include "chrome/browser/instant/instant_controller.h" |
| 10 #include "chrome/browser/instant/instant_unload_handler.h" | 10 #include "chrome/browser/instant/instant_unload_handler.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // The omnibox currently doesn't use other dispositions, so we don't attempt | 70 // The omnibox currently doesn't use other dispositions, so we don't attempt |
| 71 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add | 71 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add |
| 72 // support for the new disposition. | 72 // support for the new disposition. |
| 73 NOTREACHED(); | 73 NOTREACHED(); |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 | 76 |
| 77 //////////////////////////////////////////////////////////////////////////////// | 77 //////////////////////////////////////////////////////////////////////////////// |
| 78 // BrowserInstantController, InstantControllerDelegate implementation: | 78 // BrowserInstantController, InstantControllerDelegate implementation: |
| 79 | 79 |
| 80 void BrowserInstantController::ShowInstant() { | 80 void BrowserInstantController::ShowInstant(int height, InstantSizeUnits units) { |
| 81 // Call ShowInstant() first, before WasShown(), so that the preview is added | 81 // Call ShowInstant() first, before WasShown(), so that the preview is added |
| 82 // to the window hierarchy before it's painted. http://crbug.com/145568 | 82 // to the window hierarchy before it's painted. http://crbug.com/145568 |
| 83 TabContents* preview = instant_->GetPreviewContents(); | 83 TabContents* preview = instant_->GetPreviewContents(); |
| 84 browser_->window()->ShowInstant(preview); | 84 browser_->window()->ShowInstant(preview, height, units); |
| 85 | 85 |
| 86 // TODO(beng): Investigate if we can avoid this and instead rely on the | 86 // TODO(beng): Investigate if we can avoid this and instead rely on the |
| 87 // visibility of the WebContentsView. | 87 // visibility of the WebContentsView. |
| 88 preview->web_contents()->WasShown(); | 88 preview->web_contents()->WasShown(); |
| 89 chrome::GetActiveWebContents(browser_)->WasHidden(); | 89 chrome::GetActiveWebContents(browser_)->WasHidden(); |
| 90 | 90 |
| 91 content::NotificationService::current()->Notify( | 91 content::NotificationService::current()->Notify( |
| 92 chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN, | 92 chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN, |
| 93 content::Source<InstantController>(instant()), | 93 content::Source<InstantController>(instant()), |
| 94 content::NotificationService::NoDetails()); | 94 content::NotificationService::NoDetails()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 void BrowserInstantController::ResetInstant() { | 173 void BrowserInstantController::ResetInstant() { |
| 174 instant_.reset( | 174 instant_.reset( |
| 175 !browser_shutdown::ShuttingDownWithoutClosingBrowsers() && | 175 !browser_shutdown::ShuttingDownWithoutClosingBrowsers() && |
| 176 browser_->is_type_tabbed() ? | 176 browser_->is_type_tabbed() ? |
| 177 InstantController::CreateInstant(browser_->profile(), this) : NULL); | 177 InstantController::CreateInstant(browser_->profile(), this) : NULL); |
| 178 instant_unload_handler_.reset(instant() ? | 178 instant_unload_handler_.reset(instant() ? |
| 179 new InstantUnloadHandler(browser_) : NULL); | 179 new InstantUnloadHandler(browser_) : NULL); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace chrome | 182 } // namespace chrome |
| OLD | NEW |