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

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

Issue 6544023: Fix crashes in ExtensionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment/TODO Created 9 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 | « chrome/browser/sessions/tab_restore_service.cc ('k') | chrome/browser/ui/browser_init.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 browser::NavigateParams params(this, url, location_bar->GetPageTransition()); 1320 browser::NavigateParams params(this, url, location_bar->GetPageTransition());
1321 params.disposition = open_disposition; 1321 params.disposition = open_disposition;
1322 // Use ADD_INHERIT_OPENER so that all pages opened by the omnibox at least 1322 // Use ADD_INHERIT_OPENER so that all pages opened by the omnibox at least
1323 // inherit the opener. In some cases the tabstrip will determine the group 1323 // inherit the opener. In some cases the tabstrip will determine the group
1324 // should be inherited, in which case the group is inherited instead of the 1324 // should be inherited, in which case the group is inherited instead of the
1325 // opener. 1325 // opener.
1326 params.tabstrip_add_types = 1326 params.tabstrip_add_types =
1327 TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER; 1327 TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER;
1328 browser::Navigate(&params); 1328 browser::Navigate(&params);
1329 1329
1330 if (profile_->GetExtensionService()->IsInstalledApp(url)) { 1330 // TODO: the ExtensionService should never be NULL, but in some cases it is,
1331 // see bug 73768. After it is resolved, the explicit test can go away.
1332 ExtensionService* service = profile_->GetExtensionService();
1333 if (service && service->IsInstalledApp(url)) {
1331 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, 1334 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
1332 extension_misc::APP_LAUNCH_OMNIBOX_LOCATION, 1335 extension_misc::APP_LAUNCH_OMNIBOX_LOCATION,
1333 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 1336 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
1334 } 1337 }
1335 } 1338 }
1336 1339
1337 void Browser::Stop() { 1340 void Browser::Stop() {
1338 UserMetrics::RecordAction(UserMetricsAction("Stop"), profile_); 1341 UserMetrics::RecordAction(UserMetricsAction("Stop"), profile_);
1339 GetSelectedTabContentsWrapper()->tab_contents()->Stop(); 1342 GetSelectedTabContentsWrapper()->tab_contents()->Stop();
1340 } 1343 }
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3510 preview_contents->controller().CopyStateFromAndPrune( 3513 preview_contents->controller().CopyStateFromAndPrune(
3511 &tab_contents->controller()); 3514 &tab_contents->controller());
3512 // TabStripModel takes ownership of preview_contents. 3515 // TabStripModel takes ownership of preview_contents.
3513 TabContentsWrapper* old_contents = 3516 TabContentsWrapper* old_contents =
3514 tab_handler_->GetTabStripModel()->ReplaceTabContentsAt( 3517 tab_handler_->GetTabStripModel()->ReplaceTabContentsAt(
3515 index, preview_contents); 3518 index, preview_contents);
3516 // InstantUnloadHandler takes ownership of old_contents. 3519 // InstantUnloadHandler takes ownership of old_contents.
3517 instant_unload_handler_->RunUnloadListenersOrDestroy(old_contents, index); 3520 instant_unload_handler_->RunUnloadListenersOrDestroy(old_contents, index);
3518 3521
3519 GURL url = preview_contents->tab_contents()->GetURL(); 3522 GURL url = preview_contents->tab_contents()->GetURL();
3520 if (profile_->GetExtensionService()->IsInstalledApp(url)) { 3523 // TODO: the ExtensionService should never be NULL, but in some cases it is,
3524 // see bug 73768. After it is resolved, the explicit test can go away.
3525 ExtensionService* service = profile_->GetExtensionService();
3526 if (service && service->IsInstalledApp(url)) {
3521 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, 3527 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
3522 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT, 3528 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT,
3523 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 3529 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
3524 } 3530 }
3525 } 3531 }
3526 3532
3527 void Browser::SetSuggestedText(const string16& text) { 3533 void Browser::SetSuggestedText(const string16& text) {
3528 window()->GetLocationBar()->SetSuggestedText(text); 3534 window()->GetLocationBar()->SetSuggestedText(text);
3529 } 3535 }
3530 3536
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
4388 // The page transition below is only for the purpose of inserting the tab. 4394 // The page transition below is only for the purpose of inserting the tab.
4389 browser->AddTab(view_source_contents, PageTransition::LINK); 4395 browser->AddTab(view_source_contents, PageTransition::LINK);
4390 } 4396 }
4391 4397
4392 if (profile_->HasSessionService()) { 4398 if (profile_->HasSessionService()) {
4393 SessionService* session_service = profile_->GetSessionService(); 4399 SessionService* session_service = profile_->GetSessionService();
4394 if (session_service) 4400 if (session_service)
4395 session_service->TabRestored(&view_source_contents->controller(), false); 4401 session_service->TabRestored(&view_source_contents->controller(), false);
4396 } 4402 }
4397 } 4403 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/tab_restore_service.cc ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698