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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
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/browser_extension_window_controller.h" 5 #include "chrome/browser/extensions/browser_extension_window_controller.h"
6 6
7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
8 #include "chrome/browser/extensions/extension_tab_util.h" 8 #include "chrome/browser/extensions/extension_tab_util.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/session_id.h" 10 #include "chrome/browser/sessions/session_id.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_tabstrip.h"
12 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
14 15
15 BrowserExtensionWindowController::BrowserExtensionWindowController( 16 BrowserExtensionWindowController::BrowserExtensionWindowController(
16 Browser* browser) 17 Browser* browser)
17 : ExtensionWindowController(browser->window(), browser->profile()), 18 : ExtensionWindowController(browser->window(), browser->profile()),
18 browser_(browser) { 19 browser_(browser) {
19 } 20 }
20 21
21 int BrowserExtensionWindowController::GetWindowId() const { 22 int BrowserExtensionWindowController::GetWindowId() const {
(...skipping 23 matching lines...) Expand all
45 DictionaryValue* result = CreateWindowValue(); 46 DictionaryValue* result = CreateWindowValue();
46 47
47 result->Set(keys::kTabsKey, ExtensionTabUtil::CreateTabList(browser_)); 48 result->Set(keys::kTabsKey, ExtensionTabUtil::CreateTabList(browser_));
48 49
49 return result; 50 return result;
50 } 51 }
51 52
52 bool BrowserExtensionWindowController::CanClose(Reason* reason) const { 53 bool BrowserExtensionWindowController::CanClose(Reason* reason) const {
53 // Don't let an extension remove the window if the user is dragging tabs 54 // Don't let an extension remove the window if the user is dragging tabs
54 // in that window. 55 // in that window.
55 if (!browser_->IsTabStripEditable()) { 56 if (!chrome::IsTabStripEditable(browser_)) {
56 *reason = ExtensionWindowController::REASON_NOT_EDITABLE; 57 *reason = ExtensionWindowController::REASON_NOT_EDITABLE;
57 return false; 58 return false;
58 } 59 }
59 return true; 60 return true;
60 } 61 }
61 62
62 void BrowserExtensionWindowController::SetFullscreenMode( 63 void BrowserExtensionWindowController::SetFullscreenMode(
63 bool is_fullscreen, 64 bool is_fullscreen,
64 const GURL& extension_url) const { 65 const GURL& extension_url) const {
65 if (browser_->window()->IsFullscreen() != is_fullscreen) 66 if (browser_->window()->IsFullscreen() != is_fullscreen)
66 browser_->ToggleFullscreenModeWithExtension(extension_url); 67 browser_->ToggleFullscreenModeWithExtension(extension_url);
67 } 68 }
68 69
69 Browser* BrowserExtensionWindowController::GetBrowser() const { 70 Browser* BrowserExtensionWindowController::GetBrowser() const {
70 return browser_; 71 return browser_;
71 } 72 }
72 73
73 bool BrowserExtensionWindowController::IsVisibleToExtension( 74 bool BrowserExtensionWindowController::IsVisibleToExtension(
74 const extensions::Extension* extension) const { 75 const extensions::Extension* extension) const {
75 // Platform apps can only see their own windows. 76 // Platform apps can only see their own windows.
76 // TODO(mihaip): what about non-Aura panels? 77 // TODO(mihaip): what about non-Aura panels?
77 return !extension->is_platform_app(); 78 return !extension->is_platform_app();
78 } 79 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/browser_action_apitest.cc ('k') | chrome/browser/extensions/chrome_app_api_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698