OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/extensions/extension_window_controller.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
| 9 #include "chrome/browser/extensions/extension_window_list.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "ui/gfx/rect.h" |
| 12 |
| 13 /////////////////////////////////////////////////////////////////////////////// |
| 14 // ExtensionWindowController |
| 15 |
| 16 ExtensionWindowController::ExtensionWindowController(BaseWindow* window, |
| 17 Profile* profile) : |
| 18 window_(window), |
| 19 profile_(profile) { |
| 20 ExtensionWindowList::GetInstance()->AddExtensionWindow(this); |
| 21 } |
| 22 |
| 23 ExtensionWindowController::~ExtensionWindowController() { |
| 24 ExtensionWindowList::GetInstance()->RemoveExtensionWindow(this); |
| 25 } |
| 26 |
| 27 bool ExtensionWindowController::MatchesProfile(Profile* match_profile, |
| 28 bool allow_incognito) const { |
| 29 return ((profile_ == match_profile) || |
| 30 (allow_incognito && |
| 31 (match_profile->HasOffTheRecordProfile() && |
| 32 match_profile->GetOffTheRecordProfile() == profile_))); |
| 33 } |
| 34 |
| 35 namespace keys = extension_tabs_module_constants; |
| 36 |
| 37 void ExtensionWindowController::SetWindowValueBounds( |
| 38 const gfx::Rect& bounds, |
| 39 base::DictionaryValue* result) const { |
| 40 result->SetInteger(keys::kLeftKey, bounds.x()); |
| 41 result->SetInteger(keys::kTopKey, bounds.y()); |
| 42 result->SetInteger(keys::kWidthKey, bounds.width()); |
| 43 result->SetInteger(keys::kHeightKey, bounds.height()); |
| 44 } |
OLD | NEW |