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/cocoa/tab_contents/instant_overlay_controller_mac.h" | 5 #include "chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.h" |
6 | 6 |
7 #include "chrome/browser/search/search.h" | 7 #include "chrome/browser/search/search.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
10 #include "chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.h" | 10 #include "chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.h" |
11 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" | 11 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
12 #include "chrome/browser/ui/search/instant_overlay_model.h" | 12 #include "chrome/browser/ui/search/instant_overlay_model.h" |
13 #include "chrome/browser/ui/search/search_model.h" | 13 #include "chrome/browser/ui/search/search_model.h" |
14 #include "chrome/browser/ui/search/search_tab_helper.h" | 14 #include "chrome/browser/ui/search/search_tab_helper.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "content/public/browser/notification_source.h" |
| 17 #include "content/public/browser/notification_types.h" |
16 | 18 |
17 InstantOverlayControllerMac::InstantOverlayControllerMac( | 19 InstantOverlayControllerMac::InstantOverlayControllerMac( |
18 Browser* browser, | 20 Browser* browser, |
19 BrowserWindowController* window, | 21 BrowserWindowController* window, |
20 OverlayableContentsController* overlay) | 22 OverlayableContentsController* overlay) |
21 : InstantOverlayController(browser), | 23 : InstantOverlayController(browser), |
22 window_(window), | 24 window_(window), |
23 overlay_(overlay) { | 25 overlay_(overlay) { |
24 } | 26 } |
25 | 27 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 SearchTabHelper::FromWebContents(active_web_contents); | 64 SearchTabHelper::FromWebContents(active_web_contents); |
63 if (search_tab_helper && | 65 if (search_tab_helper && |
64 search_tab_helper->model()->mode().is_origin_default()) { | 66 search_tab_helper->model()->mode().is_origin_default()) { |
65 search_tab_helper->model()->SetTopBarsVisible( | 67 search_tab_helper->model()->SetTopBarsVisible( |
66 ![overlay_ isShowingOverlay]); | 68 ![overlay_ isShowingOverlay]); |
67 } | 69 } |
68 } | 70 } |
69 } | 71 } |
70 | 72 |
71 [window_ updateBookmarkBarStateForInstantOverlay]; | 73 [window_ updateBookmarkBarStateForInstantOverlay]; |
| 74 |
| 75 registrar_.RemoveAll(); |
| 76 if (model.GetOverlayContents()) { |
| 77 registrar_.Add( |
| 78 this, |
| 79 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 80 content::Source<content::WebContents>(model.GetOverlayContents())); |
| 81 } |
72 } | 82 } |
| 83 |
| 84 void InstantOverlayControllerMac::Observe( |
| 85 int type, |
| 86 const content::NotificationSource& source, |
| 87 const content::NotificationDetails& details) { |
| 88 [overlay_ onWebContentsDestroyed: |
| 89 content::Source<content::WebContents>(source).ptr()]; |
| 90 } |
OLD | NEW |