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/window_controller.h" | 5 #include "chrome/browser/extensions/window_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "base/values.h" | 11 #include "base/values.h" |
10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 12 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
11 #include "chrome/browser/extensions/window_controller_list.h" | 13 #include "chrome/browser/extensions/window_controller_list.h" |
12 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/extensions/api/windows.h" | 15 #include "chrome/common/extensions/api/windows.h" |
14 #include "ui/base/base_window.h" | 16 #include "ui/base/base_window.h" |
15 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
16 | 18 |
17 namespace extensions { | 19 namespace extensions { |
18 | 20 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 63 |
62 WindowController::~WindowController() { | 64 WindowController::~WindowController() { |
63 } | 65 } |
64 | 66 |
65 Browser* WindowController::GetBrowser() const { | 67 Browser* WindowController::GetBrowser() const { |
66 return NULL; | 68 return NULL; |
67 } | 69 } |
68 | 70 |
69 namespace keys = tabs_constants; | 71 namespace keys = tabs_constants; |
70 | 72 |
71 base::DictionaryValue* WindowController::CreateWindowValue() const { | 73 std::unique_ptr<base::DictionaryValue> WindowController::CreateWindowValue() |
72 base::DictionaryValue* result = new base::DictionaryValue(); | 74 const { |
| 75 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
73 | 76 |
74 result->SetInteger(keys::kIdKey, GetWindowId()); | 77 result->SetInteger(keys::kIdKey, GetWindowId()); |
75 result->SetString(keys::kWindowTypeKey, GetWindowTypeText()); | 78 result->SetString(keys::kWindowTypeKey, GetWindowTypeText()); |
76 result->SetBoolean(keys::kFocusedKey, window()->IsActive()); | 79 result->SetBoolean(keys::kFocusedKey, window()->IsActive()); |
77 result->SetBoolean(keys::kIncognitoKey, profile_->IsOffTheRecord()); | 80 result->SetBoolean(keys::kIncognitoKey, profile_->IsOffTheRecord()); |
78 result->SetBoolean(keys::kAlwaysOnTopKey, window()->IsAlwaysOnTop()); | 81 result->SetBoolean(keys::kAlwaysOnTopKey, window()->IsAlwaysOnTop()); |
79 | 82 |
80 std::string window_state; | 83 std::string window_state; |
81 if (window()->IsMinimized()) { | 84 if (window()->IsMinimized()) { |
82 window_state = keys::kShowStateValueMinimized; | 85 window_state = keys::kShowStateValueMinimized; |
(...skipping 18 matching lines...) Expand all Loading... |
101 | 104 |
102 return result; | 105 return result; |
103 } | 106 } |
104 | 107 |
105 bool WindowController::MatchesFilter(TypeFilter filter) const { | 108 bool WindowController::MatchesFilter(TypeFilter filter) const { |
106 TypeFilter type = 1 << api::windows::ParseWindowType(GetWindowTypeText()); | 109 TypeFilter type = 1 << api::windows::ParseWindowType(GetWindowTypeText()); |
107 return (type & filter) != 0; | 110 return (type & filter) != 0; |
108 } | 111 } |
109 | 112 |
110 } // namespace extensions | 113 } // namespace extensions |
OLD | NEW |