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/extension_function_dispatcher.h" | 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| 11 #include "chrome/browser/extensions/extension_system.h" |
10 #include "chrome/browser/extensions/extension_tab_util.h" | 12 #include "chrome/browser/extensions/extension_tab_util.h" |
11 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 13 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
12 #include "chrome/browser/extensions/extension_window_controller.h" | 14 #include "chrome/browser/extensions/extension_window_controller.h" |
13 #include "chrome/browser/extensions/extension_window_list.h" | 15 #include "chrome/browser/extensions/extension_window_list.h" |
14 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/sessions/session_id.h" | 17 #include "chrome/browser/sessions/session_id.h" |
16 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
18 #include "chrome/common/chrome_view_type.h" | 20 #include "chrome/common/chrome_view_type.h" |
19 #include "chrome/common/extensions/extension_messages.h" | 21 #include "chrome/common/extensions/extension_messages.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 183 |
182 // Overriden from ExtensionWindowController: | 184 // Overriden from ExtensionWindowController: |
183 virtual int GetWindowId() const OVERRIDE; | 185 virtual int GetWindowId() const OVERRIDE; |
184 virtual std::string GetWindowTypeText() const OVERRIDE; | 186 virtual std::string GetWindowTypeText() const OVERRIDE; |
185 virtual base::DictionaryValue* CreateWindowValue() const OVERRIDE; | 187 virtual base::DictionaryValue* CreateWindowValue() const OVERRIDE; |
186 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; | 188 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; |
187 virtual bool CanClose(Reason* reason) const OVERRIDE; | 189 virtual bool CanClose(Reason* reason) const OVERRIDE; |
188 virtual void SetFullscreenMode(bool is_fullscreen, | 190 virtual void SetFullscreenMode(bool is_fullscreen, |
189 const GURL& extension_url) const OVERRIDE; | 191 const GURL& extension_url) const OVERRIDE; |
190 | 192 |
| 193 protected: |
| 194 virtual bool IsVisibleToExtension(const Extension* extension) const OVERRIDE; |
| 195 |
191 private: | 196 private: |
192 PanelViewAura* panel_view_; | 197 PanelViewAura* panel_view_; |
193 PanelHost* panel_host_; | 198 PanelHost* panel_host_; |
194 | 199 |
195 DISALLOW_COPY_AND_ASSIGN(PanelExtensionWindowController); | 200 DISALLOW_COPY_AND_ASSIGN(PanelExtensionWindowController); |
196 }; | 201 }; |
197 | 202 |
198 PanelExtensionWindowController::PanelExtensionWindowController( | 203 PanelExtensionWindowController::PanelExtensionWindowController( |
199 PanelViewAura* panel_view, | 204 PanelViewAura* panel_view, |
200 PanelHost* panel_host) | 205 PanelHost* panel_host) |
(...skipping 29 matching lines...) Expand all Loading... |
230 } | 235 } |
231 | 236 |
232 bool PanelExtensionWindowController::CanClose(Reason* reason) const { | 237 bool PanelExtensionWindowController::CanClose(Reason* reason) const { |
233 return true; | 238 return true; |
234 } | 239 } |
235 | 240 |
236 void PanelExtensionWindowController::SetFullscreenMode( | 241 void PanelExtensionWindowController::SetFullscreenMode( |
237 bool is_fullscreen, const GURL& extension_url) const { | 242 bool is_fullscreen, const GURL& extension_url) const { |
238 } | 243 } |
239 | 244 |
| 245 bool PanelExtensionWindowController::IsVisibleToExtension( |
| 246 const Extension* extension) const { |
| 247 ExtensionProcessManager* process_manager = |
| 248 ExtensionSystem::Get(panel_host_->profile())->process_manager(); |
| 249 const Extension* panel_extension = process_manager-> |
| 250 GetExtensionForRenderViewHost( |
| 251 panel_view_->WebContents()->GetRenderViewHost()); |
| 252 |
| 253 // Non-extension panels are visible to all extensions. |
| 254 if (!panel_extension) |
| 255 return !extension->is_platform_app(); |
| 256 |
| 257 // Platform apps can only see their own panels. |
| 258 if (extension->is_platform_app()) |
| 259 return extension == panel_extension; |
| 260 |
| 261 // Other extensions can see non-platform app panels. |
| 262 return !panel_extension->is_platform_app(); |
| 263 } |
| 264 |
240 } // namespace internal | 265 } // namespace internal |
241 | 266 |
242 //////////////////////////////////////////////////////////////////////////////// | 267 //////////////////////////////////////////////////////////////////////////////// |
243 // PanelViewAura | 268 // PanelViewAura |
244 | 269 |
245 PanelViewAura::PanelViewAura(const std::string& title) | 270 PanelViewAura::PanelViewAura(const std::string& title) |
246 : title_(title), | 271 : title_(title), |
247 preferred_size_(kMinWidth, kMinHeight), | 272 preferred_size_(kMinWidth, kMinHeight), |
248 widget_(NULL) { | 273 widget_(NULL) { |
249 } | 274 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 440 } |
416 | 441 |
417 void PanelViewAura::FlashFrame(bool flash) { | 442 void PanelViewAura::FlashFrame(bool flash) { |
418 // TODO(stevenjb): Implement | 443 // TODO(stevenjb): Implement |
419 NOTIMPLEMENTED(); | 444 NOTIMPLEMENTED(); |
420 } | 445 } |
421 | 446 |
422 bool PanelViewAura::IsAlwaysOnTop() const { | 447 bool PanelViewAura::IsAlwaysOnTop() const { |
423 return true; | 448 return true; |
424 } | 449 } |
OLD | NEW |