| OLD | NEW |
| 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 Loading... |
| 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" | |
| 51 #include "chrome/browser/extensions/extension_tabs_module.h" | 50 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 52 #include "chrome/browser/extensions/extensions_service.h" | 51 #include "chrome/browser/extensions/extensions_service.h" |
| 53 #include "chrome/browser/find_bar.h" | 52 #include "chrome/browser/find_bar.h" |
| 54 #include "chrome/browser/find_bar_controller.h" | 53 #include "chrome/browser/find_bar_controller.h" |
| 55 #include "chrome/browser/first_run/first_run.h" | 54 #include "chrome/browser/first_run/first_run.h" |
| 56 #include "chrome/browser/google/google_url_tracker.h" | 55 #include "chrome/browser/google/google_url_tracker.h" |
| 57 #include "chrome/browser/google/google_util.h" | 56 #include "chrome/browser/google/google_util.h" |
| 58 #include "chrome/browser/host_zoom_map.h" | 57 #include "chrome/browser/host_zoom_map.h" |
| 59 #include "chrome/browser/location_bar.h" | 58 #include "chrome/browser/location_bar.h" |
| 60 #include "chrome/browser/metrics/user_metrics.h" | 59 #include "chrome/browser/metrics/user_metrics.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 GURL& url, Browser** browser) { | 549 GURL& url, Browser** browser) { |
| 551 return OpenApplicationWindow(profile, NULL, extension_misc::LAUNCH_WINDOW, | 550 return OpenApplicationWindow(profile, NULL, extension_misc::LAUNCH_WINDOW, |
| 552 url, browser); | 551 url, browser); |
| 553 } | 552 } |
| 554 | 553 |
| 555 // static | 554 // static |
| 556 TabContents* Browser::OpenApplicationTab(Profile* profile, | 555 TabContents* Browser::OpenApplicationTab(Profile* profile, |
| 557 Extension* extension, | 556 Extension* extension, |
| 558 Browser** browser) { | 557 Browser** browser) { |
| 559 Browser* local_browser = BrowserList::GetLastActiveWithProfile(profile); | 558 Browser* local_browser = BrowserList::GetLastActiveWithProfile(profile); |
| 560 TabContents* tab_contents = NULL; | |
| 561 if (!local_browser || local_browser->type() != Browser::TYPE_NORMAL) | 559 if (!local_browser || local_browser->type() != Browser::TYPE_NORMAL) |
| 562 return tab_contents; | 560 return NULL; |
| 563 | 561 |
| 564 // Check the prefs for overridden mode. | 562 // TODO(erikkay): This doesn't seem like the right transition in all cases. |
| 565 ExtensionsService* extensions_service = profile->GetExtensionsService(); | 563 PageTransition::Type transition = PageTransition::START_PAGE; |
| 566 DCHECK(extensions_service); | |
| 567 | 564 |
| 568 ExtensionPrefs::LaunchType launch_type = | 565 return local_browser->AddTabWithURL( |
| 569 extensions_service->extension_prefs()->GetLaunchType(extension->id()); | 566 extension->GetFullLaunchURL(), GURL(), transition, -1, |
| 570 int add_type = TabStripModel::ADD_SELECTED; | 567 TabStripModel::ADD_PINNED | TabStripModel::ADD_SELECTED, |
| 571 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) | 568 NULL, "", browser); |
| 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; | |
| 582 } | 569 } |
| 583 | 570 |
| 584 // static | 571 // static |
| 585 void Browser::OpenBookmarkManagerWindow(Profile* profile) { | 572 void Browser::OpenBookmarkManagerWindow(Profile* profile) { |
| 586 Browser* browser = Browser::Create(profile); | 573 Browser* browser = Browser::Create(profile); |
| 587 browser->ShowBookmarkManagerTab(); | 574 browser->ShowBookmarkManagerTab(); |
| 588 browser->window()->Show(); | 575 browser->window()->Show(); |
| 589 } | 576 } |
| 590 | 577 |
| 591 #if defined(OS_MACOSX) | 578 #if defined(OS_MACOSX) |
| (...skipping 3553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4145 disposition == NEW_FOREGROUND_TAB ? TabStripModel::ADD_SELECTED : | 4132 disposition == NEW_FOREGROUND_TAB ? TabStripModel::ADD_SELECTED : |
| 4146 TabStripModel::ADD_NONE); | 4133 TabStripModel::ADD_NONE); |
| 4147 return true; | 4134 return true; |
| 4148 } | 4135 } |
| 4149 // The omnibox currently doesn't use other dispositions, so we don't attempt | 4136 // The omnibox currently doesn't use other dispositions, so we don't attempt |
| 4150 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add | 4137 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add |
| 4151 // support for the new disposition. | 4138 // support for the new disposition. |
| 4152 NOTREACHED(); | 4139 NOTREACHED(); |
| 4153 return false; | 4140 return false; |
| 4154 } | 4141 } |
| OLD | NEW |