| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/extensions/manifest_handlers/app_launch_info.h" | 5 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 const AppLaunchInfo& GetAppLaunchInfo(const Extension* extension) { | 53 const AppLaunchInfo& GetAppLaunchInfo(const Extension* extension) { |
| 54 AppLaunchInfo* info = static_cast<AppLaunchInfo*>( | 54 AppLaunchInfo* info = static_cast<AppLaunchInfo*>( |
| 55 extension->GetManifestData(keys::kLaunch)); | 55 extension->GetManifestData(keys::kLaunch)); |
| 56 return info ? *info : g_empty_app_launch_info.Get(); | 56 return info ? *info : g_empty_app_launch_info.Get(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 AppLaunchInfo::AppLaunchInfo() | 61 AppLaunchInfo::AppLaunchInfo() |
| 62 : launch_container_(LAUNCH_TAB), | 62 : launch_container_(LAUNCH_CONTAINER_TAB), |
| 63 launch_width_(0), | 63 launch_width_(0), |
| 64 launch_height_(0) { | 64 launch_height_(0) { |
| 65 } | 65 } |
| 66 | 66 |
| 67 AppLaunchInfo::~AppLaunchInfo() { | 67 AppLaunchInfo::~AppLaunchInfo() { |
| 68 } | 68 } |
| 69 | 69 |
| 70 // static | 70 // static |
| 71 const std::string& AppLaunchInfo::GetLaunchLocalPath( | 71 const std::string& AppLaunchInfo::GetLaunchLocalPath( |
| 72 const Extension* extension) { | 72 const Extension* extension) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 &tmp_launcher_container)) | 231 &tmp_launcher_container)) |
| 232 return true; | 232 return true; |
| 233 | 233 |
| 234 std::string launch_container_string; | 234 std::string launch_container_string; |
| 235 if (!tmp_launcher_container->GetAsString(&launch_container_string)) { | 235 if (!tmp_launcher_container->GetAsString(&launch_container_string)) { |
| 236 *error = ASCIIToUTF16(errors::kInvalidLaunchContainer); | 236 *error = ASCIIToUTF16(errors::kInvalidLaunchContainer); |
| 237 return false; | 237 return false; |
| 238 } | 238 } |
| 239 | 239 |
| 240 if (launch_container_string == values::kLaunchContainerPanel) { | 240 if (launch_container_string == values::kLaunchContainerPanel) { |
| 241 launch_container_ = LAUNCH_PANEL; | 241 launch_container_ = LAUNCH_CONTAINER_PANEL; |
| 242 } else if (launch_container_string == values::kLaunchContainerTab) { | 242 } else if (launch_container_string == values::kLaunchContainerTab) { |
| 243 launch_container_ = LAUNCH_TAB; | 243 launch_container_ = LAUNCH_CONTAINER_TAB; |
| 244 } else { | 244 } else { |
| 245 *error = ASCIIToUTF16(errors::kInvalidLaunchContainer); | 245 *error = ASCIIToUTF16(errors::kInvalidLaunchContainer); |
| 246 return false; | 246 return false; |
| 247 } | 247 } |
| 248 | 248 |
| 249 bool can_specify_initial_size = launch_container_ == LAUNCH_PANEL; | 249 bool can_specify_initial_size = launch_container_ == LAUNCH_CONTAINER_PANEL; |
| 250 | 250 |
| 251 // Validate the container width if present. | 251 // Validate the container width if present. |
| 252 if (!ReadLaunchDimension(extension->manifest(), | 252 if (!ReadLaunchDimension(extension->manifest(), |
| 253 keys::kLaunchWidth, | 253 keys::kLaunchWidth, |
| 254 &launch_width_, | 254 &launch_width_, |
| 255 can_specify_initial_size, | 255 can_specify_initial_size, |
| 256 error)) { | 256 error)) { |
| 257 return false; | 257 return false; |
| 258 } | 258 } |
| 259 | 259 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 keys::kLaunchLocalPath, | 316 keys::kLaunchLocalPath, |
| 317 keys::kLaunchWebURL, | 317 keys::kLaunchWebURL, |
| 318 keys::kLaunchContainer, | 318 keys::kLaunchContainer, |
| 319 keys::kLaunchHeight, | 319 keys::kLaunchHeight, |
| 320 keys::kLaunchWidth | 320 keys::kLaunchWidth |
| 321 }; | 321 }; |
| 322 return std::vector<std::string>(keys, keys + arraysize(keys)); | 322 return std::vector<std::string>(keys, keys + arraysize(keys)); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace extensions | 325 } // namespace extensions |
| OLD | NEW |