Chromium Code Reviews| Index: chrome/browser/content_settings/permission_bubble_request_impl.cc |
| diff --git a/chrome/browser/services/gcm/permission_bubble_request_impl.cc b/chrome/browser/content_settings/permission_bubble_request_impl.cc |
| similarity index 61% |
| rename from chrome/browser/services/gcm/permission_bubble_request_impl.cc |
| rename to chrome/browser/content_settings/permission_bubble_request_impl.cc |
| index 2fa530d389e51a7871b5aac2289e7aa7f4db6fc1..e06c006195232bbe57afa64349f2dd42f9fa5667 100644 |
| --- a/chrome/browser/services/gcm/permission_bubble_request_impl.cc |
| +++ b/chrome/browser/content_settings/permission_bubble_request_impl.cc |
| @@ -2,16 +2,14 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/services/gcm/permission_bubble_request_impl.h" |
| +#include "chrome/browser/content_settings/permission_bubble_request_impl.h" |
| -#include "chrome/browser/services/gcm/permission_context_base.h" |
| +#include "chrome/browser/content_settings/permission_context_base.h" |
| #include "grit/generated_resources.h" |
| #include "grit/theme_resources.h" |
| #include "net/base/net_util.h" |
| #include "ui/base/l10n/l10n_util.h" |
| -namespace gcm { |
| - |
| PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( |
| const GURL& request_origin, |
| bool user_gesture, |
| @@ -25,40 +23,64 @@ PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( |
| display_languages_(display_languages), |
| permission_decided_callback_(permission_decided_callback), |
| delete_callback_(delete_callback), |
| - is_finished_(false) {} |
| + is_finished_(false) { |
| +} |
| PermissionBubbleRequestImpl::~PermissionBubbleRequestImpl() { |
| DCHECK(is_finished_); |
| } |
| int PermissionBubbleRequestImpl::GetIconID() const { |
| + int icon_id; |
| switch (type_) { |
| + case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| + icon_id = IDR_ALLOWED_MIDI_SYSEX; |
|
Bernhard Bauer
2014/07/04 10:24:13
Directly return the icon ID?
Miguel Garcia
2014/07/04 12:09:52
I did it this way to be consistent with the other
|
| + break; |
| case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
| - return IDR_INFOBAR_WARNING; |
| + icon_id = IDR_INFOBAR_WARNING; |
| + break; |
| default: |
| NOTREACHED(); |
| + return IDR_INFOBAR_WARNING; |
| } |
| - return IDR_INFOBAR_WARNING; |
| + return icon_id; |
| } |
| base::string16 PermissionBubbleRequestImpl::GetMessageText() const { |
| + int message_id; |
| switch (type_) { |
| + case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| + message_id = IDS_MIDI_SYSEX_INFOBAR_QUESTION; |
| + break; |
| case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
| - return l10n_util::GetStringUTF16(IDS_PUSH_MESSAGES_BUBBLE_TEXT); |
| + message_id = IDS_PUSH_MESSAGES_PERMISSION_QUESTION; |
| + break; |
| default: |
| NOTREACHED(); |
| + return base::string16(); |
| } |
| - return base::string16(); |
| + return l10n_util::GetStringFUTF16( |
| + message_id, |
|
Bernhard Bauer
2014/07/04 10:24:13
Align four spaces.
Miguel Garcia
2014/07/04 12:09:52
Done.
|
| + net::FormatUrl(request_origin_, display_languages_, |
| + net::kFormatUrlOmitUsernamePassword | |
| + net::kFormatUrlOmitTrailingSlashOnBareHostname, |
| + net::UnescapeRule::SPACES, NULL, NULL, NULL)); |
| } |
| base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { |
| + int message_id; |
| switch (type_) { |
| - case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
| - return l10n_util::GetStringUTF16(IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT); |
| - default: |
| - NOTREACHED(); |
| - } |
| - return base::string16(); |
| + case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| + message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT; |
| + break; |
| + case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
| + message_id = IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT; |
| + break; |
| + default: |
| + NOTREACHED(); |
| + return base::string16(); |
| + } |
| + return l10n_util::GetStringUTF16(message_id); |
| } |
| bool PermissionBubbleRequestImpl::HasUserGesture() const { |
| @@ -85,5 +107,3 @@ void PermissionBubbleRequestImpl::RequestFinished() { |
| is_finished_ = true; |
| delete_callback_.Run(); |
| } |
| - |
| -} // namespace gcm |