| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/public/common/window_container_type.h" | 5 #include "content/public/common/window_container_type.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| 11 #include "third_party/WebKit/public/platform/WebVector.h" | 11 #include "third_party/WebKit/public/platform/WebVector.h" |
| 12 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 12 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 const char kBackground[] = "background"; | 16 const char kBackground[] = "background"; |
| 17 const char kPersistent[] = "persistent"; | 17 const char kPersistent[] = "persistent"; |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 const WindowContainerType WINDOW_CONTAINER_TYPE_NORMAL = |
| 22 content::mojom::WindowContainerType::NORMAL; |
| 23 const WindowContainerType WINDOW_CONTAINER_TYPE_BACKGROUND = |
| 24 content::mojom::WindowContainerType::BACKGROUND; |
| 25 const WindowContainerType WINDOW_CONTAINER_TYPE_PERSISTENT = |
| 26 content::mojom::WindowContainerType::PERSISTENT; |
| 27 |
| 21 WindowContainerType WindowFeaturesToContainerType( | 28 WindowContainerType WindowFeaturesToContainerType( |
| 22 const blink::WebWindowFeatures& window_features) { | 29 const blink::WebWindowFeatures& window_features) { |
| 23 bool background = false; | 30 bool background = false; |
| 24 bool persistent = false; | 31 bool persistent = false; |
| 25 | 32 |
| 26 for (size_t i = 0; i < window_features.additionalFeatures.size(); ++i) { | 33 for (size_t i = 0; i < window_features.additionalFeatures.size(); ++i) { |
| 27 base::string16 feature = window_features.additionalFeatures[i]; | 34 base::string16 feature = window_features.additionalFeatures[i]; |
| 28 if (base::LowerCaseEqualsASCII(feature, kBackground)) | 35 if (base::LowerCaseEqualsASCII(feature, kBackground)) |
| 29 background = true; | 36 background = true; |
| 30 else if (base::LowerCaseEqualsASCII(feature, kPersistent)) | 37 else if (base::LowerCaseEqualsASCII(feature, kPersistent)) |
| 31 persistent = true; | 38 persistent = true; |
| 32 } | 39 } |
| 33 | 40 |
| 34 if (background) { | 41 if (background) { |
| 35 if (persistent) | 42 if (persistent) |
| 36 return WINDOW_CONTAINER_TYPE_PERSISTENT; | 43 return WINDOW_CONTAINER_TYPE_PERSISTENT; |
| 37 else | 44 else |
| 38 return WINDOW_CONTAINER_TYPE_BACKGROUND; | 45 return WINDOW_CONTAINER_TYPE_BACKGROUND; |
| 39 } else { | 46 } else { |
| 40 return WINDOW_CONTAINER_TYPE_NORMAL; | 47 return WINDOW_CONTAINER_TYPE_NORMAL; |
| 41 } | 48 } |
| 42 } | 49 } |
| OLD | NEW |