| 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/views/ash/panel_view_aura.h" | 5 #include "chrome/browser/ui/views/ash/panel_view_aura.h" |
| 6 | 6 |
| 7 #include "ash/wm/panel_frame_view.h" | 7 #include "ash/wm/panel_frame_view.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 10 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 10 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // ExtensionFunctionDispatcher::Delegate overrides. | 60 // ExtensionFunctionDispatcher::Delegate overrides. |
| 61 virtual extensions::WindowController* GetExtensionWindowController() | 61 virtual extensions::WindowController* GetExtensionWindowController() |
| 62 const OVERRIDE; | 62 const OVERRIDE; |
| 63 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; | 63 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
| 64 | 64 |
| 65 // content::WebContentsDelegate implementation: | 65 // content::WebContentsDelegate implementation: |
| 66 virtual void CloseContents(content::WebContents* source) OVERRIDE; | 66 virtual void CloseContents(content::WebContents* source) OVERRIDE; |
| 67 virtual void HandleMouseDown() OVERRIDE; | 67 virtual void HandleMouseDown() OVERRIDE; |
| 68 virtual void UpdatePreferredSize(content::WebContents* source, | 68 virtual void UpdatePreferredSize(content::WebContents* source, |
| 69 const gfx::Size& pref_size) OVERRIDE; | 69 const gfx::Size& pref_size) OVERRIDE; |
| 70 virtual void AddNewContents(content::WebContents* source, | 70 virtual bool AddNewContents(content::WebContents* source, |
| 71 content::WebContents* new_contents, | 71 content::WebContents* new_contents, |
| 72 WindowOpenDisposition disposition, | 72 WindowOpenDisposition disposition, |
| 73 const gfx::Rect& initial_pos, | 73 const gfx::Rect& initial_pos, |
| 74 bool user_gesture) OVERRIDE; | 74 bool user_gesture) OVERRIDE; |
| 75 | 75 |
| 76 // content::WebContentsObserver implementation: | 76 // content::WebContentsObserver implementation: |
| 77 virtual void RenderViewCreated( | 77 virtual void RenderViewCreated( |
| 78 content::RenderViewHost* render_view_host) OVERRIDE; | 78 content::RenderViewHost* render_view_host) OVERRIDE; |
| 79 virtual void RenderViewReady() OVERRIDE; | 79 virtual void RenderViewReady() OVERRIDE; |
| 80 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 80 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 | 133 |
| 134 void PanelHost::UpdatePreferredSize(content::WebContents* source, | 134 void PanelHost::UpdatePreferredSize(content::WebContents* source, |
| 135 const gfx::Size& pref_size) { | 135 const gfx::Size& pref_size) { |
| 136 panel_view_->SetContentPreferredSize(pref_size); | 136 panel_view_->SetContentPreferredSize(pref_size); |
| 137 } | 137 } |
| 138 | 138 |
| 139 // This handles launching a new page from within the panel. | 139 // This handles launching a new page from within the panel. |
| 140 // TODO(stevenjb): Determine whether or not this is the desired/expected | 140 // TODO(stevenjb): Determine whether or not this is the desired/expected |
| 141 // behavior for panels. | 141 // behavior for panels. |
| 142 void PanelHost::AddNewContents(content::WebContents* source, | 142 bool PanelHost::AddNewContents(content::WebContents* source, |
| 143 content::WebContents* new_contents, | 143 content::WebContents* new_contents, |
| 144 WindowOpenDisposition disposition, | 144 WindowOpenDisposition disposition, |
| 145 const gfx::Rect& initial_pos, | 145 const gfx::Rect& initial_pos, |
| 146 bool user_gesture) { | 146 bool user_gesture) { |
| 147 Browser* browser = browser::FindLastActiveWithProfile( | 147 Browser* browser = browser::FindLastActiveWithProfile( |
| 148 Profile::FromBrowserContext(new_contents->GetBrowserContext())); | 148 Profile::FromBrowserContext(new_contents->GetBrowserContext())); |
| 149 if (browser) { | 149 if (browser) { |
| 150 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 150 return chrome::AddWebContents(browser, NULL, new_contents, disposition, |
| 151 initial_pos, user_gesture); | 151 initial_pos, user_gesture); |
| 152 } | 152 } |
| 153 return true; |
| 153 } | 154 } |
| 154 | 155 |
| 155 void PanelHost::RenderViewCreated(content::RenderViewHost* render_view_host) { | 156 void PanelHost::RenderViewCreated(content::RenderViewHost* render_view_host) { |
| 156 } | 157 } |
| 157 | 158 |
| 158 void PanelHost::RenderViewReady() { | 159 void PanelHost::RenderViewReady() { |
| 159 } | 160 } |
| 160 | 161 |
| 161 void PanelHost::RenderViewGone(base::TerminationStatus status) { | 162 void PanelHost::RenderViewGone(base::TerminationStatus status) { |
| 162 CloseContents(web_contents_.get()); | 163 CloseContents(web_contents_.get()); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 450 } |
| 450 | 451 |
| 451 void PanelViewAura::FlashFrame(bool flash) { | 452 void PanelViewAura::FlashFrame(bool flash) { |
| 452 // TODO(stevenjb): Implement | 453 // TODO(stevenjb): Implement |
| 453 NOTIMPLEMENTED(); | 454 NOTIMPLEMENTED(); |
| 454 } | 455 } |
| 455 | 456 |
| 456 bool PanelViewAura::IsAlwaysOnTop() const { | 457 bool PanelViewAura::IsAlwaysOnTop() const { |
| 457 return true; | 458 return true; |
| 458 } | 459 } |
| OLD | NEW |