| OLD | NEW |
| 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/notifications/notification_options_menu_model.h" | 5 #include "chrome/browser/notifications/notification_options_menu_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 else | 232 else |
| 233 service->GrantPermission(origin); | 233 service->GrantPermission(origin); |
| 234 break; | 234 break; |
| 235 case kToggleExtensionCommand: { | 235 case kToggleExtensionCommand: { |
| 236 const Extension* extension = | 236 const Extension* extension = |
| 237 extension_service->extensions()->GetExtensionOrAppByURL( | 237 extension_service->extensions()->GetExtensionOrAppByURL( |
| 238 ExtensionURLInfo(origin)); | 238 ExtensionURLInfo(origin)); |
| 239 if (extension) { | 239 if (extension) { |
| 240 const std::string& id = extension->id(); | 240 const std::string& id = extension->id(); |
| 241 if (extension_service->IsExtensionEnabled(id)) | 241 if (extension_service->IsExtensionEnabled(id)) |
| 242 extension_service->DisableExtension(id); | 242 extension_service->DisableExtension( |
| 243 id, Extension::DISABLE_USER_ACTION); |
| 243 else | 244 else |
| 244 extension_service->EnableExtension(id); | 245 extension_service->EnableExtension(id); |
| 245 } | 246 } |
| 246 break; | 247 break; |
| 247 } | 248 } |
| 248 case kOpenContentSettingsCommand: { | 249 case kOpenContentSettingsCommand: { |
| 249 Browser* browser = | 250 Browser* browser = |
| 250 BrowserList::GetLastActiveWithProfile(balloon_->profile()); | 251 BrowserList::GetLastActiveWithProfile(balloon_->profile()); |
| 251 if (!browser) { | 252 if (!browser) { |
| 252 // It is possible that there is no browser window (e.g. when there are | 253 // It is possible that there is no browser window (e.g. when there are |
| 253 // background pages, or for a chrome frame process on windows). | 254 // background pages, or for a chrome frame process on windows). |
| 254 browser = Browser::Create(balloon_->profile()); | 255 browser = Browser::Create(balloon_->profile()); |
| 255 } | 256 } |
| 256 browser->ShowContentSettingsPage(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 257 browser->ShowContentSettingsPage(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
| 257 break; | 258 break; |
| 258 } | 259 } |
| 259 default: | 260 default: |
| 260 NOTREACHED(); | 261 NOTREACHED(); |
| 261 break; | 262 break; |
| 262 } | 263 } |
| 263 } | 264 } |
| OLD | NEW |