| 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" |
| 11 #include "chrome/browser/extensions/extension_process_manager.h" | 11 #include "chrome/browser/extensions/extension_process_manager.h" |
| 12 #include "chrome/browser/extensions/extension_system.h" | 12 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "chrome/browser/extensions/extension_tab_util.h" | 13 #include "chrome/browser/extensions/extension_tab_util.h" |
| 14 #include "chrome/browser/extensions/window_controller.h" | 14 #include "chrome/browser/extensions/window_controller.h" |
| 15 #include "chrome/browser/extensions/window_controller_list.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/sessions/session_id.h" | 17 #include "chrome/browser/sessions/session_id.h" |
| 17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
| 19 #include "chrome/browser/ui/browser_tabstrip.h" | 20 #include "chrome/browser/ui/browser_tabstrip.h" |
| 20 #include "chrome/browser/view_type_utils.h" | 21 #include "chrome/browser/view_type_utils.h" |
| 21 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/extensions/extension_messages.h" | 23 #include "chrome/common/extensions/extension_messages.h" |
| 23 #include "content/public/browser/site_instance.h" | 24 #include "content/public/browser/site_instance.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 web_contents_->GetRenderViewHost()); | 176 web_contents_->GetRenderViewHost()); |
| 176 } | 177 } |
| 177 | 178 |
| 178 //////////////////////////////////////////////////////////////////////////////// | 179 //////////////////////////////////////////////////////////////////////////////// |
| 179 // PanelExtensionWindowController | 180 // PanelExtensionWindowController |
| 180 | 181 |
| 181 class PanelExtensionWindowController : public extensions::WindowController { | 182 class PanelExtensionWindowController : public extensions::WindowController { |
| 182 public: | 183 public: |
| 183 PanelExtensionWindowController(PanelViewAura* panel_view, | 184 PanelExtensionWindowController(PanelViewAura* panel_view, |
| 184 PanelHost* panel_host); | 185 PanelHost* panel_host); |
| 186 virtual ~PanelExtensionWindowController(); |
| 185 | 187 |
| 186 // Overriden from extensions::WindowController: | 188 // Overriden from extensions::WindowController: |
| 187 virtual int GetWindowId() const OVERRIDE; | 189 virtual int GetWindowId() const OVERRIDE; |
| 188 virtual std::string GetWindowTypeText() const OVERRIDE; | 190 virtual std::string GetWindowTypeText() const OVERRIDE; |
| 189 virtual base::DictionaryValue* CreateWindowValue() const OVERRIDE; | 191 virtual base::DictionaryValue* CreateWindowValue() const OVERRIDE; |
| 190 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; | 192 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; |
| 191 virtual bool CanClose(Reason* reason) const OVERRIDE; | 193 virtual bool CanClose(Reason* reason) const OVERRIDE; |
| 192 virtual void SetFullscreenMode(bool is_fullscreen, | 194 virtual void SetFullscreenMode(bool is_fullscreen, |
| 193 const GURL& extension_url) const OVERRIDE; | 195 const GURL& extension_url) const OVERRIDE; |
| 194 virtual bool IsVisibleToExtension( | 196 virtual bool IsVisibleToExtension( |
| 195 const extensions::Extension* extension) const OVERRIDE; | 197 const extensions::Extension* extension) const OVERRIDE; |
| 196 | 198 |
| 197 private: | 199 private: |
| 198 PanelViewAura* panel_view_; | 200 PanelViewAura* panel_view_; |
| 199 PanelHost* panel_host_; | 201 PanelHost* panel_host_; |
| 200 | 202 |
| 201 DISALLOW_COPY_AND_ASSIGN(PanelExtensionWindowController); | 203 DISALLOW_COPY_AND_ASSIGN(PanelExtensionWindowController); |
| 202 }; | 204 }; |
| 203 | 205 |
| 204 PanelExtensionWindowController::PanelExtensionWindowController( | 206 PanelExtensionWindowController::PanelExtensionWindowController( |
| 205 PanelViewAura* panel_view, | 207 PanelViewAura* panel_view, |
| 206 PanelHost* panel_host) | 208 PanelHost* panel_host) |
| 207 : extensions::WindowController(panel_view, panel_host->profile()), | 209 : extensions::WindowController(panel_view, panel_host->profile()), |
| 208 panel_view_(panel_view), | 210 panel_view_(panel_view), |
| 209 panel_host_(panel_host) { | 211 panel_host_(panel_host) { |
| 212 extensions::WindowControllerList::GetInstance()->AddExtensionWindow(this); |
| 213 } |
| 214 |
| 215 PanelExtensionWindowController::~PanelExtensionWindowController() { |
| 216 extensions::WindowControllerList::GetInstance()->RemoveExtensionWindow(this); |
| 210 } | 217 } |
| 211 | 218 |
| 212 int PanelExtensionWindowController::GetWindowId() const { | 219 int PanelExtensionWindowController::GetWindowId() const { |
| 213 return static_cast<int>(panel_view_->session_id().id()); | 220 return static_cast<int>(panel_view_->session_id().id()); |
| 214 } | 221 } |
| 215 | 222 |
| 216 std::string PanelExtensionWindowController::GetWindowTypeText() const { | 223 std::string PanelExtensionWindowController::GetWindowTypeText() const { |
| 217 return keys::kWindowTypeValuePanel; | 224 return keys::kWindowTypeValuePanel; |
| 218 } | 225 } |
| 219 | 226 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 453 } |
| 447 | 454 |
| 448 void PanelViewAura::FlashFrame(bool flash) { | 455 void PanelViewAura::FlashFrame(bool flash) { |
| 449 // TODO(stevenjb): Implement | 456 // TODO(stevenjb): Implement |
| 450 NOTIMPLEMENTED(); | 457 NOTIMPLEMENTED(); |
| 451 } | 458 } |
| 452 | 459 |
| 453 bool PanelViewAura::IsAlwaysOnTop() const { | 460 bool PanelViewAura::IsAlwaysOnTop() const { |
| 454 return true; | 461 return true; |
| 455 } | 462 } |
| OLD | NEW |