| 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/extensions/api/app_current_window_internal/app_current_
window_internal_api.h" | 5 #include "chrome/browser/extensions/api/app_current_window_internal/app_current_
window_internal_api.h" |
| 6 | 6 |
| 7 #include "apps/app_window.h" | |
| 8 #include "apps/app_window_registry.h" | |
| 9 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/extensions/api/app_current_window_internal.h" | 9 #include "chrome/common/extensions/api/app_current_window_internal.h" |
| 12 #include "chrome/common/extensions/api/app_window.h" | 10 #include "chrome/common/extensions/api/app_window.h" |
| 13 #include "chrome/common/extensions/features/feature_channel.h" | 11 #include "chrome/common/extensions/features/feature_channel.h" |
| 12 #include "extensions/browser/app_window/app_window.h" |
| 13 #include "extensions/browser/app_window/app_window_registry.h" |
| 14 #include "extensions/browser/app_window/native_app_window.h" | 14 #include "extensions/browser/app_window/native_app_window.h" |
| 15 #include "extensions/browser/app_window/size_constraints.h" | 15 #include "extensions/browser/app_window/size_constraints.h" |
| 16 #include "extensions/common/features/simple_feature.h" | 16 #include "extensions/common/features/simple_feature.h" |
| 17 #include "extensions/common/permissions/permissions_data.h" | 17 #include "extensions/common/permissions/permissions_data.h" |
| 18 #include "extensions/common/switches.h" | 18 #include "extensions/common/switches.h" |
| 19 #include "third_party/skia/include/core/SkRegion.h" | 19 #include "third_party/skia/include/core/SkRegion.h" |
| 20 | 20 |
| 21 namespace app_current_window_internal = | 21 namespace app_current_window_internal = |
| 22 extensions::api::app_current_window_internal; | 22 extensions::api::app_current_window_internal; |
| 23 | 23 |
| 24 namespace Show = app_current_window_internal::Show; | 24 namespace Show = app_current_window_internal::Show; |
| 25 namespace SetBounds = app_current_window_internal::SetBounds; | 25 namespace SetBounds = app_current_window_internal::SetBounds; |
| 26 namespace SetSizeConstraints = app_current_window_internal::SetSizeConstraints; | 26 namespace SetSizeConstraints = app_current_window_internal::SetSizeConstraints; |
| 27 namespace SetIcon = app_current_window_internal::SetIcon; | 27 namespace SetIcon = app_current_window_internal::SetIcon; |
| 28 namespace SetBadgeIcon = app_current_window_internal::SetBadgeIcon; | 28 namespace SetBadgeIcon = app_current_window_internal::SetBadgeIcon; |
| 29 namespace SetShape = app_current_window_internal::SetShape; | 29 namespace SetShape = app_current_window_internal::SetShape; |
| 30 namespace SetAlwaysOnTop = app_current_window_internal::SetAlwaysOnTop; | 30 namespace SetAlwaysOnTop = app_current_window_internal::SetAlwaysOnTop; |
| 31 | 31 |
| 32 using apps::AppWindow; | |
| 33 using app_current_window_internal::Bounds; | 32 using app_current_window_internal::Bounds; |
| 34 using app_current_window_internal::Region; | 33 using app_current_window_internal::Region; |
| 35 using app_current_window_internal::RegionRect; | 34 using app_current_window_internal::RegionRect; |
| 36 using app_current_window_internal::SizeConstraints; | 35 using app_current_window_internal::SizeConstraints; |
| 37 | 36 |
| 38 namespace extensions { | 37 namespace extensions { |
| 39 | 38 |
| 40 namespace { | 39 namespace { |
| 41 | 40 |
| 42 const char kNoAssociatedAppWindow[] = | 41 const char kNoAssociatedAppWindow[] = |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return OUTER_BOUNDS; | 111 return OUTER_BOUNDS; |
| 113 else if (type_as_string == kDeprecatedBoundsType) | 112 else if (type_as_string == kDeprecatedBoundsType) |
| 114 return DEPRECATED_BOUNDS; | 113 return DEPRECATED_BOUNDS; |
| 115 else | 114 else |
| 116 return INVALID_TYPE; | 115 return INVALID_TYPE; |
| 117 } | 116 } |
| 118 | 117 |
| 119 } // namespace bounds | 118 } // namespace bounds |
| 120 | 119 |
| 121 bool AppCurrentWindowInternalExtensionFunction::RunSync() { | 120 bool AppCurrentWindowInternalExtensionFunction::RunSync() { |
| 122 apps::AppWindowRegistry* registry = | 121 AppWindowRegistry* registry = AppWindowRegistry::Get(GetProfile()); |
| 123 apps::AppWindowRegistry::Get(GetProfile()); | |
| 124 DCHECK(registry); | 122 DCHECK(registry); |
| 125 content::RenderViewHost* rvh = render_view_host(); | 123 content::RenderViewHost* rvh = render_view_host(); |
| 126 if (!rvh) | 124 if (!rvh) |
| 127 // No need to set an error, since we won't return to the caller anyway if | 125 // No need to set an error, since we won't return to the caller anyway if |
| 128 // there's no RVH. | 126 // there's no RVH. |
| 129 return false; | 127 return false; |
| 130 AppWindow* window = registry->GetAppWindowForRenderViewHost(rvh); | 128 AppWindow* window = registry->GetAppWindowForRenderViewHost(rvh); |
| 131 if (!window) { | 129 if (!window) { |
| 132 error_ = kNoAssociatedAppWindow; | 130 error_ = kNoAssociatedAppWindow; |
| 133 return false; | 131 return false; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } | 392 } |
| 395 | 393 |
| 396 scoped_ptr<SetAlwaysOnTop::Params> params( | 394 scoped_ptr<SetAlwaysOnTop::Params> params( |
| 397 SetAlwaysOnTop::Params::Create(*args_)); | 395 SetAlwaysOnTop::Params::Create(*args_)); |
| 398 CHECK(params.get()); | 396 CHECK(params.get()); |
| 399 window->SetAlwaysOnTop(params->always_on_top); | 397 window->SetAlwaysOnTop(params->always_on_top); |
| 400 return true; | 398 return true; |
| 401 } | 399 } |
| 402 | 400 |
| 403 } // namespace extensions | 401 } // namespace extensions |
| OLD | NEW |