summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-20 21:46:33 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-20 21:46:33 +0000
commit94ce7252d9efa9d13159dc941cc7f2b762d11d7d (patch)
tree0cfc39951e912be776752589baffb4a0a34b93f3
parent61be2e5772dd83d9af3f9f07522928ca479c66a3 (diff)
downloadchromium_src-94ce7252d9efa9d13159dc941cc7f2b762d11d7d.zip
chromium_src-94ce7252d9efa9d13159dc941cc7f2b762d11d7d.tar.gz
chromium_src-94ce7252d9efa9d13159dc941cc7f2b762d11d7d.tar.bz2
Cleanup: RemoveCleanup: Remove Browser::extension_app_* and TYPE_EXTENSION_APP.
BUG=65630 TEST=BrowserTest.ConvertTabToAppShortcut, manually open apps and non app windows. Review URL: http://codereview.chromium.org/5849002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69757 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/wm_overview_controller.cc5
-rw-r--r--chrome/browser/ui/browser.cc57
-rw-r--r--chrome/browser/ui/browser.h31
-rw-r--r--chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript_test.mm6
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_win.cc3
5 files changed, 39 insertions, 63 deletions
diff --git a/chrome/browser/chromeos/wm_overview_controller.cc b/chrome/browser/chromeos/wm_overview_controller.cc
index 1de3330..778af64 100644
--- a/chrome/browser/chromeos/wm_overview_controller.cc
+++ b/chrome/browser/chromeos/wm_overview_controller.cc
@@ -687,7 +687,7 @@ void WmOverviewController::UpdateSnapshots() {
}
// Found next one;
- browser_listener_index ++;
+ browser_listener_index++;
browser_listener_index = browser_listener_index % listeners_.size();
tab_contents_index = -1;
@@ -715,8 +715,7 @@ void WmOverviewController::AddAllBrowsers() {
// Don't add a browser to the list if that type of browser doesn't
// have snapshots in overview mode.
if ((*iterator)->type() != Browser::TYPE_NORMAL &&
- (*iterator)->type() != Browser::TYPE_APP &&
- (*iterator)->type() != Browser::TYPE_EXTENSION_APP) {
+ (*iterator)->type() != Browser::TYPE_APP) {
++iterator;
continue;
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 8dc6886..c3604db 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -204,8 +204,7 @@ Browser::Browser(Type type, Profile* profile)
block_command_execution_(false),
last_blocked_command_id_(-1),
last_blocked_command_disposition_(CURRENT_TAB),
- pending_web_app_action_(NONE),
- extension_app_(NULL) {
+ pending_web_app_action_(NONE) {
registrar_.Add(this, NotificationType::SSL_VISIBLE_STATE_CHANGED,
NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED,
@@ -337,7 +336,7 @@ Browser* Browser::CreateForType(Type type, Profile* profile) {
// static
Browser* Browser::CreateForApp(const std::string& app_name,
- const Extension* extension,
+ const gfx::Size& window_size,
Profile* profile,
bool is_panel) {
Browser::Type type = TYPE_APP;
@@ -346,19 +345,14 @@ Browser* Browser::CreateForApp(const std::string& app_name,
// TYPE_APP_PANEL is the logical choice. However, the panel UI
// is not fully implemented. See crbug/55943.
type = TYPE_APP_POPUP;
- } else if (extension) {
- type = TYPE_EXTENSION_APP;
}
Browser* browser = new Browser(type, profile);
browser->app_name_ = app_name;
- browser->extension_app_ = extension;
- if (extension) {
- gfx::Rect initial_pos(extension->launch_width(),
- extension->launch_height());
- if (!initial_pos.IsEmpty())
- browser->set_override_bounds(initial_pos);
+ if (!window_size.IsEmpty()) {
+ gfx::Rect initial_pos(window_size);
+ browser->set_override_bounds(initial_pos);
}
browser->CreateBrowserWindow();
@@ -516,15 +510,6 @@ TabContents* Browser::OpenApplication(
switch (container) {
case extension_misc::LAUNCH_WINDOW:
- // TODO(skerner): Setting |extension| to NULL is odd.
- // Not doing so triggers some vestigial extensions app window
- // behavior that leads to crashes. This sort of window is no
- // longer supported, and its remains need to be cleaned up.
- // crbug/65630 tracks this cleanup.
- tab = Browser::OpenApplicationWindow(profile, NULL, container,
- extension->GetFullLaunchURL(),
- NULL);
- break;
case extension_misc::LAUNCH_PANEL:
tab = Browser::OpenApplicationWindow(profile, extension, container,
GURL(), NULL);
@@ -562,7 +547,13 @@ TabContents* Browser::OpenApplicationWindow(
RegisterAppPrefs(app_name);
bool as_panel = extension && (container == extension_misc::LAUNCH_PANEL);
- Browser* browser = Browser::CreateForApp(app_name, extension, profile,
+
+ gfx::Size window_size;
+ if (extension)
+ window_size.SetSize(extension->launch_width(),
+ extension->launch_height());
+
+ Browser* browser = Browser::CreateForApp(app_name, window_size, profile,
as_panel);
if (app_browser)
*app_browser = browser;
@@ -1191,16 +1182,16 @@ bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
}
if (!hide_ui_for_fullscreen) {
- if (type() != TYPE_NORMAL && type() != TYPE_EXTENSION_APP)
+ if (type() != TYPE_NORMAL)
features |= FEATURE_TITLEBAR;
- if (type() == TYPE_NORMAL || type() == TYPE_EXTENSION_APP)
+ if (type() == TYPE_NORMAL)
features |= FEATURE_TABSTRIP;
- if (type() == TYPE_NORMAL || type() == TYPE_EXTENSION_APP)
+ if (type() == TYPE_NORMAL)
features |= FEATURE_TOOLBAR;
- if (type() != TYPE_EXTENSION_APP && (type() & Browser::TYPE_APP) == 0)
+ if ((type() & Browser::TYPE_APP) == 0)
features |= FEATURE_LOCATIONBAR;
}
return !!(features & feature);
@@ -2459,8 +2450,7 @@ bool Browser::CanDuplicateContentsAt(int index) {
void Browser::DuplicateContentsAt(int index) {
TabContentsWrapper* contents = GetTabContentsWrapperAt(index);
- DCHECK(contents);
-
+ CHECK(contents);
TabContentsWrapper* contents_dupe = contents->Clone();
InsertContentsDupe(contents, contents_dupe);
}
@@ -2545,7 +2535,7 @@ bool Browser::LargeIconsPermitted() const {
// We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because
// for those windows, we already have a big icon in the top-left outside any
// tab. Having big tab icons too looks kinda redonk.
- return TYPE_EXTENSION_APP != type();
+ return true;
}
///////////////////////////////////////////////////////////////////////////////
@@ -2929,7 +2919,8 @@ void Browser::ConvertContentsToApplication(TabContents* contents) {
RegisterAppPrefs(app_name);
DetachContents(contents);
- Browser* app_browser = Browser::CreateForApp(app_name, NULL, profile_, false);
+ Browser* app_browser = Browser::CreateForApp(
+ app_name, gfx::Size(), profile_, false);
TabContentsWrapper* wrapper = new TabContentsWrapper(contents);
app_browser->tabstrip_model()->AppendTabContents(wrapper, true);
@@ -4180,7 +4171,7 @@ void Browser::ViewSource(TabContentsWrapper* contents) {
void Browser::InsertContentsDupe(
TabContentsWrapper* contents,
TabContentsWrapper* contents_dupe) {
- DCHECK(contents);
+ CHECK(contents);
TabContents* new_contents = contents_dupe->tab_contents();
bool pinned = false;
@@ -4200,9 +4191,9 @@ void Browser::InsertContentsDupe(
} else {
Browser* browser = NULL;
if (type_ & TYPE_APP) {
- DCHECK((type_ & TYPE_POPUP) == 0);
- DCHECK(type_ != TYPE_APP_PANEL);
- browser = Browser::CreateForApp(app_name_, extension_app_, profile_,
+ CHECK((type_ & TYPE_POPUP) == 0);
+ CHECK(type_ != TYPE_APP_PANEL);
+ browser = Browser::CreateForApp(app_name_, gfx::Size(), profile_,
false);
} else if (type_ == TYPE_POPUP) {
browser = Browser::CreateForType(TYPE_POPUP, profile_);
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 3f8f691b..33153a4 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -63,32 +63,27 @@ class Browser : public TabHandlerDelegate,
public ProfileSyncServiceObserver,
public InstantDelegate {
public:
- // If you change the values in this enum you'll need to update browser_proxy.
- // TODO(sky): move into a common place that is referenced by both ui_tests
- // and chrome.
+ // SessionService::WindowType mirrors these values. If you add to this
+ // enum, look at SessionService::WindowType to see if it needs to be
+ // updated.
enum Type {
TYPE_NORMAL = 1,
TYPE_POPUP = 2,
// The old-style app created via "Create application shortcuts".
+ // Shortcuts to a URL and shortcuts to an installed application
+ // both have this type.
TYPE_APP = 4,
- // The new-style app created by installing a crx. This kinda needs to be
- // separate because we require larger icons and an application name that
- // are found in the crx. If we ever decide to create this kind of app
- // using some other system (eg some web standard), maybe we should
- // generalize this name to TYPE_MULTITAB or something.
- TYPE_EXTENSION_APP = 8,
TYPE_APP_POPUP = TYPE_APP | TYPE_POPUP,
- TYPE_DEVTOOLS = TYPE_APP | 16,
+ TYPE_DEVTOOLS = TYPE_APP | 8,
// TODO(skerner): crbug/56776: Until the panel UI is complete on all
// platforms, apps that set app.launch.container = "panel" have type
// APP_POPUP. (see Browser::CreateForApp)
// NOTE: TYPE_APP_PANEL is a superset of TYPE_APP_POPUP.
- TYPE_APP_PANEL = TYPE_APP | TYPE_POPUP | 32,
+ TYPE_APP_PANEL = TYPE_APP | TYPE_POPUP | 16,
TYPE_ANY = TYPE_NORMAL |
TYPE_POPUP |
TYPE_APP |
- TYPE_EXTENSION_APP |
TYPE_DEVTOOLS |
TYPE_APP_PANEL
};
@@ -144,10 +139,10 @@ class Browser : public TabHandlerDelegate,
// Like Create, but creates a toolbar-less "app" window for the specified
// app. |app_name| is required and is used to identify the window to the
- // shell. |extension| is optional. If supplied, we create a window with
- // a bigger icon and title text, that supports tabs.
+ // shell. If |extension| is set, it is used to determine the size of the
+ // window to open.
static Browser* CreateForApp(const std::string& app_name,
- const Extension* extension,
+ const gfx::Size& window_size,
Profile* profile,
bool is_panel);
@@ -155,9 +150,6 @@ class Browser : public TabHandlerDelegate,
// DevTools "app" window.
static Browser* CreateForDevTools(Profile* profile);
- // Returns the extension app associated with this window, if any.
- const Extension* extension_app() { return extension_app_; }
-
// Set overrides for the initial window bounds and maximized state.
void set_override_bounds(const gfx::Rect& bounds) {
override_bounds_ = bounds;
@@ -1127,9 +1119,6 @@ class Browser : public TabHandlerDelegate,
// from a TabContents. Currently, only one pending action is allowed.
WebAppAction pending_web_app_action_;
- // The extension app associated with this window, if any.
- const Extension* extension_app_;
-
// Tracks the display mode of the tabstrip.
mutable BooleanPrefMember use_vertical_tabs_;
diff --git a/chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript_test.mm b/chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript_test.mm
index 269a9ec..31af858 100644
--- a/chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript_test.mm
+++ b/chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript_test.mm
@@ -10,6 +10,7 @@
#import "chrome/browser/ui/cocoa/applescript/constants_applescript.h"
#import "chrome/browser/ui/cocoa/applescript/window_applescript.h"
#include "chrome/test/in_process_browser_test.h"
+#include "gfx/size.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gtest_mac.h"
@@ -20,8 +21,8 @@ IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, Creation) {
// Create additional |Browser*| objects of different type.
Profile* profile = browser()->profile();
Browser* b1 = Browser::CreateForType(Browser::TYPE_POPUP, profile);
- Browser* b2 = Browser::CreateForApp("", NULL, profile, true);
- Browser* b3 = Browser::CreateForApp("", NULL, profile, false);
+ Browser* b2 = Browser::CreateForApp("", gfx::Size(), profile, true);
+ Browser* b3 = Browser::CreateForApp("", gfx::Size(), profile, false);
EXPECT_EQ(4U, [[NSApp appleScriptWindows] count]);
for (WindowAppleScript* window in [NSApp appleScriptWindows]) {
@@ -104,4 +105,3 @@ IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, BookmarkFolders) {
EXPECT_NSEQ(@"Other Bookmarks", [[NSApp otherBookmarks] title]);
EXPECT_NSEQ(@"Bookmarks Bar", [[NSApp bookmarksBar] title]);
}
-
diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc
index af22a58..d747f73 100644
--- a/chrome/browser/ui/views/frame/browser_frame_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_win.cc
@@ -105,9 +105,6 @@ bool BrowserFrameWin::AlwaysUseNativeFrame() const {
if (browser_view_->IsBrowserTypePanel())
return false;
- if (browser_view_->browser()->type() == Browser::TYPE_EXTENSION_APP)
- return false;
-
// We don't theme popup or app windows, so regardless of whether or not a
// theme is active for normal browser windows, we don't want to use the custom
// frame for popups/apps.