| 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/ui/browser.h" | 5 #include "chrome/browser/ui/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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 603 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); |
| 604 TabContents* contents = NULL; | 604 TabContents* contents = NULL; |
| 605 if (!browser || browser->type() != Browser::TYPE_NORMAL) | 605 if (!browser || browser->type() != Browser::TYPE_NORMAL) |
| 606 return contents; | 606 return contents; |
| 607 | 607 |
| 608 // Check the prefs for overridden mode. | 608 // Check the prefs for overridden mode. |
| 609 ExtensionsService* extensions_service = profile->GetExtensionsService(); | 609 ExtensionsService* extensions_service = profile->GetExtensionsService(); |
| 610 DCHECK(extensions_service); | 610 DCHECK(extensions_service); |
| 611 | 611 |
| 612 ExtensionPrefs::LaunchType launch_type = | 612 ExtensionPrefs::LaunchType launch_type = |
| 613 extensions_service->extension_prefs()->GetLaunchType(extension->id()); | 613 extensions_service->extension_prefs()->GetLaunchType( |
| 614 extension->id(), ExtensionPrefs::LAUNCH_REGULAR); |
| 614 UMA_HISTOGRAM_ENUMERATION("Extensions.AppTabLaunchType", launch_type, 100); | 615 UMA_HISTOGRAM_ENUMERATION("Extensions.AppTabLaunchType", launch_type, 100); |
| 615 int add_type = TabStripModel::ADD_SELECTED; | 616 int add_type = TabStripModel::ADD_SELECTED; |
| 616 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) | 617 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) |
| 617 add_type |= TabStripModel::ADD_PINNED; | 618 add_type |= TabStripModel::ADD_PINNED; |
| 618 | 619 |
| 619 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all | 620 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all |
| 620 // cases. | 621 // cases. |
| 621 browser::NavigateParams params(browser, extension->GetFullLaunchURL(), | 622 browser::NavigateParams params(browser, extension->GetFullLaunchURL(), |
| 622 PageTransition::START_PAGE); | 623 PageTransition::START_PAGE); |
| 623 params.tabstrip_add_types = add_type; | 624 params.tabstrip_add_types = add_type; |
| (...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3123 TabContents* current_tab = GetSelectedTabContents(); | 3124 TabContents* current_tab = GetSelectedTabContents(); |
| 3124 if (current_tab != tab_contents) | 3125 if (current_tab != tab_contents) |
| 3125 return; | 3126 return; |
| 3126 | 3127 |
| 3127 NavigationEntry* entry = current_tab->controller().GetLastCommittedEntry(); | 3128 NavigationEntry* entry = current_tab->controller().GetLastCommittedEntry(); |
| 3128 if (!entry || (entry->page_id() != page_id)) | 3129 if (!entry || (entry->page_id() != page_id)) |
| 3129 return; | 3130 return; |
| 3130 | 3131 |
| 3131 switch (pending_web_app_action_) { | 3132 switch (pending_web_app_action_) { |
| 3132 case CREATE_SHORTCUT: { | 3133 case CREATE_SHORTCUT: { |
| 3133 window()->ShowCreateShortcutsDialog(current_tab); | 3134 window()->ShowCreateWebAppShortcutsDialog(current_tab); |
| 3134 break; | 3135 break; |
| 3135 } | 3136 } |
| 3136 case UPDATE_SHORTCUT: { | 3137 case UPDATE_SHORTCUT: { |
| 3137 web_app::UpdateShortcutForTabContents(current_tab); | 3138 web_app::UpdateShortcutForTabContents(current_tab); |
| 3138 break; | 3139 break; |
| 3139 } | 3140 } |
| 3140 default: | 3141 default: |
| 3141 NOTREACHED(); | 3142 NOTREACHED(); |
| 3142 break; | 3143 break; |
| 3143 } | 3144 } |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4135 NOTREACHED(); | 4136 NOTREACHED(); |
| 4136 return false; | 4137 return false; |
| 4137 } | 4138 } |
| 4138 | 4139 |
| 4139 void Browser::CreateInstantIfNecessary() { | 4140 void Browser::CreateInstantIfNecessary() { |
| 4140 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && | 4141 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && |
| 4141 !profile()->IsOffTheRecord()) { | 4142 !profile()->IsOffTheRecord()) { |
| 4142 instant_.reset(new InstantController(profile_, this)); | 4143 instant_.reset(new InstantController(profile_, this)); |
| 4143 } | 4144 } |
| 4144 } | 4145 } |
| OLD | NEW |