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

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

Issue 557026: Disables pinned tabs until I land apps. I've #ifdef parts that are... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sessions/session_restore.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_init.h" 5 #include "chrome/browser/browser_init.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/event_recorder.h" 9 #include "base/event_recorder.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 Browser* browser, 581 Browser* browser,
582 bool process_startup, 582 bool process_startup,
583 const std::vector<GURL>& urls) { 583 const std::vector<GURL>& urls) {
584 DCHECK(!urls.empty()); 584 DCHECK(!urls.empty());
585 // If we don't yet have a profile, try to use the one we're given from 585 // If we don't yet have a profile, try to use the one we're given from
586 // |browser|. While we may not end up actually using |browser| (since it 586 // |browser|. While we may not end up actually using |browser| (since it
587 // could be a popup window), we can at least use the profile. 587 // could be a popup window), we can at least use the profile.
588 if (!profile_ && browser) 588 if (!profile_ && browser)
589 profile_ = browser->profile(); 589 profile_ = browser->profile();
590 590
591 int pin_count = 0;
592 if (!browser) {
593 std::string pin_count_string =
594 command_line_.GetSwitchValueASCII(switches::kPinnedTabCount);
595 if (!pin_count_string.empty())
596 pin_count = StringToInt(pin_count_string);
597 }
598 if (!browser || browser->type() != Browser::TYPE_NORMAL) 591 if (!browser || browser->type() != Browser::TYPE_NORMAL)
599 browser = Browser::Create(profile_); 592 browser = Browser::Create(profile_);
600 593
601 #if !defined(OS_MACOSX) 594 #if !defined(OS_MACOSX)
602 // In kiosk mode, we want to always be fullscreen, so switch to that now. 595 // In kiosk mode, we want to always be fullscreen, so switch to that now.
603 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode)) 596 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
604 browser->ToggleFullscreenMode(); 597 browser->ToggleFullscreenMode();
605 #endif 598 #endif
606 599
607 for (size_t i = 0; i < urls.size(); ++i) { 600 for (size_t i = 0; i < urls.size(); ++i) {
608 // We skip URLs that we'd have to launch an external protocol handler for. 601 // We skip URLs that we'd have to launch an external protocol handler for.
609 // This avoids us getting into an infinite loop asking ourselves to open 602 // This avoids us getting into an infinite loop asking ourselves to open
610 // a URL, should the handler be (incorrectly) configured to be us. Anyone 603 // a URL, should the handler be (incorrectly) configured to be us. Anyone
611 // asking us to open such a URL should really ask the handler directly. 604 // asking us to open such a URL should really ask the handler directly.
612 if (!process_startup && !URLRequest::IsHandledURL(urls[i])) 605 if (!process_startup && !URLRequest::IsHandledURL(urls[i]))
613 continue; 606 continue;
614 TabContents* tab = browser->AddTabWithURL( 607 TabContents* tab = browser->AddTabWithURL(
615 urls[i], GURL(), PageTransition::START_PAGE, (i == 0), -1, false, NULL); 608 urls[i], GURL(), PageTransition::START_PAGE, (i == 0), -1, false, NULL);
616 if (i < static_cast<size_t>(pin_count))
617 browser->tabstrip_model()->SetTabPinned(browser->tab_count() - 1, true);
618 if (profile_ && i == 0 && process_startup) 609 if (profile_ && i == 0 && process_startup)
619 AddCrashedInfoBarIfNecessary(tab); 610 AddCrashedInfoBarIfNecessary(tab);
620 } 611 }
621 browser->window()->Show(); 612 browser->window()->Show();
622 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial 613 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial
623 // focus explicitly. 614 // focus explicitly.
624 browser->GetSelectedTabContents()->view()->SetInitialFocus(); 615 browser->GetSelectedTabContents()->view()->SetInitialFocus();
625 616
626 return browser; 617 return browser;
627 } 618 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 scoped_refptr<AutomationProviderClass> automation = 888 scoped_refptr<AutomationProviderClass> automation =
898 new AutomationProviderClass(profile); 889 new AutomationProviderClass(profile);
899 automation->ConnectToChannel(channel_id); 890 automation->ConnectToChannel(channel_id);
900 automation->SetExpectedTabCount(expected_tabs); 891 automation->SetExpectedTabCount(expected_tabs);
901 892
902 AutomationProviderList* list = 893 AutomationProviderList* list =
903 g_browser_process->InitAutomationProviderList(); 894 g_browser_process->InitAutomationProviderList();
904 DCHECK(list); 895 DCHECK(list);
905 list->AddProvider(automation); 896 list->AddProvider(automation);
906 } 897 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698