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 "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "third_party/WebKit/public/platform/WebString.h" | 8 #include "third_party/WebKit/public/platform/WebString.h" |
9 #include "third_party/WebKit/public/platform/WebVector.h" | 9 #include "third_party/WebKit/public/platform/WebVector.h" |
10 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 10 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 const char kBackground[] = "background"; | 14 const char kBackground[] = "background"; |
15 const char kPersistent[] = "persistent"; | 15 const char kPersistent[] = "persistent"; |
16 | 16 |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 WindowContainerType WindowFeaturesToContainerType( | 19 WindowContainerType WindowFeaturesToContainerType( |
20 const blink::WebWindowFeatures& window_features) { | 20 const blink::WebWindowFeatures& window_features) { |
21 bool background = false; | 21 bool background = false; |
22 bool persistent = false; | 22 bool persistent = false; |
23 | 23 |
24 for (size_t i = 0; i < window_features.additionalFeatures.size(); ++i) { | 24 for (size_t i = 0; i < window_features.additionalFeatures.size(); ++i) { |
25 if (base::LowerCaseEqualsASCII( | 25 if (LowerCaseEqualsASCII(window_features.additionalFeatures[i], |
26 base::string16(window_features.additionalFeatures[i]), | 26 kBackground)) |
27 kBackground)) | |
28 background = true; | 27 background = true; |
29 else if (base::LowerCaseEqualsASCII( | 28 else if (LowerCaseEqualsASCII(window_features.additionalFeatures[i], |
30 base::string16(window_features.additionalFeatures[i]), | 29 kPersistent)) |
31 kPersistent)) | |
32 persistent = true; | 30 persistent = true; |
33 } | 31 } |
34 | 32 |
35 if (background) { | 33 if (background) { |
36 if (persistent) | 34 if (persistent) |
37 return WINDOW_CONTAINER_TYPE_PERSISTENT; | 35 return WINDOW_CONTAINER_TYPE_PERSISTENT; |
38 else | 36 else |
39 return WINDOW_CONTAINER_TYPE_BACKGROUND; | 37 return WINDOW_CONTAINER_TYPE_BACKGROUND; |
40 } else { | 38 } else { |
41 return WINDOW_CONTAINER_TYPE_NORMAL; | 39 return WINDOW_CONTAINER_TYPE_NORMAL; |
42 } | 40 } |
43 } | 41 } |
OLD | NEW |