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

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

Issue 3453029: Add user customizable launch type for apps. (Closed)
Patch Set: No images this time. Created 10 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 29 matching lines...) Expand all
40 #include "chrome/browser/dom_ui/filebrowse_ui.h" 40 #include "chrome/browser/dom_ui/filebrowse_ui.h"
41 #include "chrome/browser/download/download_item.h" 41 #include "chrome/browser/download/download_item.h"
42 #include "chrome/browser/download/download_item_model.h" 42 #include "chrome/browser/download/download_item_model.h"
43 #include "chrome/browser/download/download_manager.h" 43 #include "chrome/browser/download/download_manager.h"
44 #include "chrome/browser/download/download_shelf.h" 44 #include "chrome/browser/download/download_shelf.h"
45 #include "chrome/browser/download/download_started_animation.h" 45 #include "chrome/browser/download/download_started_animation.h"
46 #include "chrome/browser/extensions/crashed_extension_infobar.h" 46 #include "chrome/browser/extensions/crashed_extension_infobar.h"
47 #include "chrome/browser/extensions/extension_browser_event_router.h" 47 #include "chrome/browser/extensions/extension_browser_event_router.h"
48 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" 48 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
49 #include "chrome/browser/extensions/extension_host.h" 49 #include "chrome/browser/extensions/extension_host.h"
50 #include "chrome/browser/extensions/extension_prefs.h"
50 #include "chrome/browser/extensions/extension_tabs_module.h" 51 #include "chrome/browser/extensions/extension_tabs_module.h"
51 #include "chrome/browser/extensions/extensions_service.h" 52 #include "chrome/browser/extensions/extensions_service.h"
52 #include "chrome/browser/find_bar.h" 53 #include "chrome/browser/find_bar.h"
53 #include "chrome/browser/find_bar_controller.h" 54 #include "chrome/browser/find_bar_controller.h"
54 #include "chrome/browser/first_run/first_run.h" 55 #include "chrome/browser/first_run/first_run.h"
55 #include "chrome/browser/google/google_url_tracker.h" 56 #include "chrome/browser/google/google_url_tracker.h"
56 #include "chrome/browser/google/google_util.h" 57 #include "chrome/browser/google/google_util.h"
57 #include "chrome/browser/host_zoom_map.h" 58 #include "chrome/browser/host_zoom_map.h"
58 #include "chrome/browser/location_bar.h" 59 #include "chrome/browser/location_bar.h"
59 #include "chrome/browser/metrics/user_metrics.h" 60 #include "chrome/browser/metrics/user_metrics.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 GURL& url, Browser** browser) { 550 GURL& url, Browser** browser) {
550 return OpenApplicationWindow(profile, NULL, extension_misc::LAUNCH_WINDOW, 551 return OpenApplicationWindow(profile, NULL, extension_misc::LAUNCH_WINDOW,
551 url, browser); 552 url, browser);
552 } 553 }
553 554
554 // static 555 // static
555 TabContents* Browser::OpenApplicationTab(Profile* profile, 556 TabContents* Browser::OpenApplicationTab(Profile* profile,
556 Extension* extension, 557 Extension* extension,
557 Browser** browser) { 558 Browser** browser) {
558 Browser* local_browser = BrowserList::GetLastActiveWithProfile(profile); 559 Browser* local_browser = BrowserList::GetLastActiveWithProfile(profile);
560 TabContents* tab_contents = NULL;
559 if (!local_browser || local_browser->type() != Browser::TYPE_NORMAL) 561 if (!local_browser || local_browser->type() != Browser::TYPE_NORMAL)
560 return NULL; 562 return tab_contents;
561 563
562 // TODO(erikkay): This doesn't seem like the right transition in all cases. 564 // Check the prefs for overridden mode.
563 PageTransition::Type transition = PageTransition::START_PAGE; 565 ExtensionsService* extensions_service = profile->GetExtensionsService();
566 DCHECK(extensions_service);
564 567
565 return local_browser->AddTabWithURL( 568 ExtensionPrefs::LaunchType launch_type =
566 extension->GetFullLaunchURL(), GURL(), transition, -1, 569 extensions_service->extension_prefs()->GetLaunchType(extension->id());
567 TabStripModel::ADD_PINNED | TabStripModel::ADD_SELECTED, 570 int add_type = TabStripModel::ADD_SELECTED;
568 NULL, "", browser); 571 if (launch_type == ExtensionPrefs::LAUNCH_PINNED)
572 add_type |= TabStripModel::ADD_PINNED;
573
574 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all
575 // cases.
576 tab_contents = local_browser->AddTabWithURL(extension->GetFullLaunchURL(),
577 GURL(), PageTransition::START_PAGE, -1, add_type, NULL, "", browser);
578 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN)
579 local_browser->window()->SetFullscreen(true);
580
581 return tab_contents;
569 } 582 }
570 583
571 // static 584 // static
572 void Browser::OpenBookmarkManagerWindow(Profile* profile) { 585 void Browser::OpenBookmarkManagerWindow(Profile* profile) {
573 Browser* browser = Browser::Create(profile); 586 Browser* browser = Browser::Create(profile);
574 browser->ShowBookmarkManagerTab(); 587 browser->ShowBookmarkManagerTab();
575 browser->window()->Show(); 588 browser->window()->Show();
576 } 589 }
577 590
578 #if defined(OS_MACOSX) 591 #if defined(OS_MACOSX)
(...skipping 3553 matching lines...) Expand 10 before | Expand all | Expand 10 after
4132 disposition == NEW_FOREGROUND_TAB ? TabStripModel::ADD_SELECTED : 4145 disposition == NEW_FOREGROUND_TAB ? TabStripModel::ADD_SELECTED :
4133 TabStripModel::ADD_NONE); 4146 TabStripModel::ADD_NONE);
4134 return true; 4147 return true;
4135 } 4148 }
4136 // The omnibox currently doesn't use other dispositions, so we don't attempt 4149 // The omnibox currently doesn't use other dispositions, so we don't attempt
4137 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add 4150 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add
4138 // support for the new disposition. 4151 // support for the new disposition.
4139 NOTREACHED(); 4152 NOTREACHED();
4140 return false; 4153 return false;
4141 } 4154 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698