Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: chrome/browser/extensions/extension_window_controller.cc

Issue 9428018: Create BaseWindow and ExtensionWindowWrapper for extension API access to Panels (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698