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/panels/panel.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
34 #include "content/public/browser/render_view_host.h" | 34 #include "content/public/browser/render_view_host.h" |
35 #include "content/public/browser/user_metrics.h" | 35 #include "content/public/browser/user_metrics.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "extensions/browser/extension_registry.h" | 37 #include "extensions/browser/extension_registry.h" |
38 #include "extensions/browser/extension_system.h" | 38 #include "extensions/browser/extension_system.h" |
39 #include "extensions/browser/image_loader.h" | 39 #include "extensions/browser/image_loader.h" |
40 #include "extensions/common/constants.h" | 40 #include "extensions/common/constants.h" |
41 #include "extensions/common/extension.h" | 41 #include "extensions/common/extension.h" |
42 #include "extensions/common/manifest_handlers/icons_handler.h" | 42 #include "extensions/common/manifest_handlers/icons_handler.h" |
43 #include "extensions/common/permissions/api_permission.h" | |
44 #include "extensions/common/permissions/permissions_data.h" | |
43 #include "ui/gfx/geometry/rect.h" | 45 #include "ui/gfx/geometry/rect.h" |
44 #include "ui/gfx/image/image.h" | 46 #include "ui/gfx/image/image.h" |
45 | 47 |
46 using base::UserMetricsAction; | 48 using base::UserMetricsAction; |
47 using content::RenderViewHost; | 49 using content::RenderViewHost; |
48 | 50 |
49 namespace panel_internal { | 51 namespace panel_internal { |
50 | 52 |
51 class PanelExtensionWindowController : public extensions::WindowController { | 53 class PanelExtensionWindowController : public extensions::WindowController { |
52 public: | 54 public: |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 return true; | 146 return true; |
145 } | 147 } |
146 | 148 |
147 void PanelExtensionWindowController::SetFullscreenMode( | 149 void PanelExtensionWindowController::SetFullscreenMode( |
148 bool is_fullscreen, const GURL& extension_url) const { | 150 bool is_fullscreen, const GURL& extension_url) const { |
149 // Do nothing. Panels cannot be fullscreen. | 151 // Do nothing. Panels cannot be fullscreen. |
150 } | 152 } |
151 | 153 |
152 bool PanelExtensionWindowController::IsVisibleToExtension( | 154 bool PanelExtensionWindowController::IsVisibleToExtension( |
153 const extensions::Extension* extension) const { | 155 const extensions::Extension* extension) const { |
156 if (extension->permissions_data()->HasAPIPermission( | |
Peter Kasting
2015/04/20 20:55:35
Nit: Shorter:
return (extension->id() == panel_
| |
157 extensions::APIPermission::kTabGlobal)) | |
158 return true; | |
154 return extension->id() == panel_->extension_id(); | 159 return extension->id() == panel_->extension_id(); |
155 } | 160 } |
156 | 161 |
157 } // namespace panel_internal | 162 } // namespace panel_internal |
158 | 163 |
159 Panel::~Panel() { | 164 Panel::~Panel() { |
160 DCHECK(!collection_); | 165 DCHECK(!collection_); |
161 #if !defined(USE_AURA) | 166 #if !defined(USE_AURA) |
162 // Invoked by native panel destructor. Do not access native_panel_ here. | 167 // Invoked by native panel destructor. Do not access native_panel_ here. |
163 chrome::DecrementKeepAliveCount(); // Remove shutdown prevention. | 168 chrome::DecrementKeepAliveCount(); // Remove shutdown prevention. |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
896 // static | 901 // static |
897 void Panel::FormatTitleForDisplay(base::string16* title) { | 902 void Panel::FormatTitleForDisplay(base::string16* title) { |
898 size_t current_index = 0; | 903 size_t current_index = 0; |
899 size_t match_index; | 904 size_t match_index; |
900 while ((match_index = title->find(L'\n', current_index)) != | 905 while ((match_index = title->find(L'\n', current_index)) != |
901 base::string16::npos) { | 906 base::string16::npos) { |
902 title->replace(match_index, 1, base::string16()); | 907 title->replace(match_index, 1, base::string16()); |
903 current_index = match_index; | 908 current_index = match_index; |
904 } | 909 } |
905 } | 910 } |
OLD | NEW |