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

Side by Side Diff: chrome/browser/extensions/browser_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: Rebase Created 8 years, 9 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/browser_extension_window_controller.h"
6
7 #include "chrome/browser/extensions/extension_tab_util.h"
8 #include "chrome/browser/extensions/extension_tabs_module_constants.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/session_id.h"
11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_window.h"
13
14 BrowserExtensionWindowController::BrowserExtensionWindowController(
15 Browser* browser)
16 : ExtensionWindowController(browser->window(), browser->profile()),
17 browser_(browser) {
18 }
19
20 const SessionID& BrowserExtensionWindowController::GetSessionId() const {
21 return browser_->session_id();
22 }
23
24 namespace keys = extension_tabs_module_constants;
25
26 base::DictionaryValue*
27 BrowserExtensionWindowController::CreateWindowValue() const {
28 DictionaryValue* result = ExtensionWindowController::CreateWindowValue();
29
30 result->SetString(keys::kWindowTypeKey,
31 ExtensionTabUtil::GetWindowTypeText(browser_));
32 result->SetString(keys::kShowStateKey,
33 ExtensionTabUtil::GetWindowShowStateText(browser_));
34
35 return result;
36 }
37
38 base::DictionaryValue*
39 BrowserExtensionWindowController::CreateWindowValueWithTabs() const {
40 DictionaryValue* result = CreateWindowValue();
41
42 result->Set(keys::kTabsKey, ExtensionTabUtil::CreateTabList(browser_));
43
44 return result;
45 }
46
47 bool BrowserExtensionWindowController::CanClose(
48 ExtensionWindowController::Reason* reason) const {
49 // Don't let an extension remove the window if the user is dragging tabs
50 // in that window.
51 if (!browser_->IsTabStripEditable()) {
52 *reason = ExtensionWindowController::REASON_TAB_STRIP_NOT_EDITABLE;
53 return false;
54 }
55 return true;
56 }
57
58 void BrowserExtensionWindowController::SetFullscreenMode(
59 bool is_fullscreen,
60 const GURL& extension_url) const {
61 if (browser_->window()->IsFullscreen() != is_fullscreen)
62 browser_->ToggleFullscreenModeWithExtension(extension_url);
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698