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

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

Issue 10912101: Fix crash in extension NavigationObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/navigation_observer.h" 5 #include "chrome/browser/extensions/navigation_observer.h"
6 6
7 #include "chrome/browser/extensions/extension_install_ui.h" 7 #include "chrome/browser/extensions/extension_install_ui.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 ExtensionService* extension_service = profile_->GetExtensionService(); 84 ExtensionService* extension_service = profile_->GetExtensionService();
85 const Extension* extension = extension_service->GetExtensionById( 85 const Extension* extension = extension_service->GetExtensionById(
86 in_progress_prompt_extension_id_, true); 86 in_progress_prompt_extension_id_, true);
87 NavigationController* nav_controller = 87 NavigationController* nav_controller =
88 in_progress_prompt_navigation_controller_; 88 in_progress_prompt_navigation_controller_;
89 CHECK(extension); 89 CHECK(extension);
90 CHECK(nav_controller); 90 CHECK(nav_controller);
91 91
92 in_progress_prompt_extension_id_ = ""; 92 in_progress_prompt_extension_id_ = "";
93 in_progress_prompt_navigation_controller_ = NULL; 93 in_progress_prompt_navigation_controller_ = NULL;
94 bool record_oauth2_grant = extension_install_prompt_->record_oauth2_grant();
94 extension_install_prompt_.reset(); 95 extension_install_prompt_.reset();
95 96
96 // Grant permissions, re-enable the extension, and then reload the tab. 97 // Grant permissions, re-enable the extension, and then reload the tab.
97 extension_service->GrantPermissionsAndEnableExtension( 98 extension_service->GrantPermissionsAndEnableExtension(
98 extension, extension_install_prompt_->record_oauth2_grant()); 99 extension, record_oauth2_grant);
99 nav_controller->Reload(true); 100 nav_controller->Reload(true);
100 } 101 }
101 102
102 void NavigationObserver::InstallUIAbort(bool user_initiated) { 103 void NavigationObserver::InstallUIAbort(bool user_initiated) {
103 ExtensionService* extension_service = profile_->GetExtensionService(); 104 ExtensionService* extension_service = profile_->GetExtensionService();
104 const Extension* extension = extension_service->GetExtensionById( 105 const Extension* extension = extension_service->GetExtensionById(
105 in_progress_prompt_extension_id_, true); 106 in_progress_prompt_extension_id_, true);
106 107
107 in_progress_prompt_extension_id_ = ""; 108 in_progress_prompt_extension_id_ = "";
108 in_progress_prompt_navigation_controller_ = NULL; 109 in_progress_prompt_navigation_controller_ = NULL;
109 extension_install_prompt_.reset(); 110 extension_install_prompt_.reset();
110 111
111 std::string histogram_name = user_initiated ? 112 std::string histogram_name = user_initiated ?
112 "Extensions.Permissions_ReEnableCancel" : 113 "Extensions.Permissions_ReEnableCancel" :
113 "Extensions.Permissions_ReEnableAbort"; 114 "Extensions.Permissions_ReEnableAbort";
114 ExtensionService::RecordPermissionMessagesHistogram( 115 ExtensionService::RecordPermissionMessagesHistogram(
115 extension, histogram_name.c_str()); 116 extension, histogram_name.c_str());
116 } 117 }
117 118
118 } // namespace extensions 119 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698