| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chooser_controller/chooser_controller.h" | 5 #include "chrome/browser/chooser_controller/chooser_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
| 9 #include "components/url_formatter/elide_url.h" | 9 #include "components/url_formatter/elide_url.h" |
| 10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "extensions/browser/extension_registry.h" | 12 #include "extensions/browser/extension_registry.h" |
| 13 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 #include "url/origin.h" | 16 #include "url/origin.h" |
| 17 | 17 |
| 18 ChooserController::ChooserController(content::RenderFrameHost* owner) | 18 ChooserController::ChooserController(content::RenderFrameHost* owner) |
| 19 : owning_frame_(owner) {} | 19 : owning_frame_(owner) {} |
| 20 | 20 |
| 21 ChooserController::~ChooserController() {} | 21 ChooserController::~ChooserController() {} |
| 22 | 22 |
| 23 base::string16 ChooserController::GetTitle() { | 23 base::string16 ChooserController::GetTitle() { |
| 24 return l10n_util::GetStringFUTF16( | 24 return l10n_util::GetStringFUTF16( |
| 25 title_prefix_has_quote_ ? IDS_DEVICE_CHOOSER_PROMPT_EXTENSION_NAME | 25 title_prefix_has_quote_ ? IDS_DEVICE_CHOOSER_PROMPT_EXTENSION_NAME |
| 26 : IDS_DEVICE_CHOOSER_PROMPT_ORIGIN, | 26 : IDS_DEVICE_CHOOSER_PROMPT_ORIGIN, |
| 27 GetTitlePrefix()); | 27 GetTitlePrefix()); |
| 28 } | 28 } |
| 29 | 29 |
| 30 base::string16 ChooserController::GetOkButtonLabel() const { |
| 31 return base::string16(); |
| 32 } |
| 33 |
| 30 base::string16 ChooserController::GetTitlePrefix() { | 34 base::string16 ChooserController::GetTitlePrefix() { |
| 31 if (!owning_frame_) | 35 if (!owning_frame_) |
| 32 return base::string16(); | 36 return base::string16(); |
| 33 | 37 |
| 34 base::string16 title_prefix; | 38 base::string16 title_prefix; |
| 35 url::Origin origin = owning_frame_->GetLastCommittedOrigin(); | 39 url::Origin origin = owning_frame_->GetLastCommittedOrigin(); |
| 36 if (origin.scheme() == extensions::kExtensionScheme) { | 40 if (origin.scheme() == extensions::kExtensionScheme) { |
| 37 content::WebContents* web_contents = | 41 content::WebContents* web_contents = |
| 38 content::WebContents::FromRenderFrameHost(owning_frame_); | 42 content::WebContents::FromRenderFrameHost(owning_frame_); |
| 39 content::BrowserContext* browser_context = | 43 content::BrowserContext* browser_context = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 50 } | 54 } |
| 51 | 55 |
| 52 if (title_prefix.empty()) { | 56 if (title_prefix.empty()) { |
| 53 title_prefix = url_formatter::FormatOriginForSecurityDisplay( | 57 title_prefix = url_formatter::FormatOriginForSecurityDisplay( |
| 54 origin, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC); | 58 origin, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC); |
| 55 title_prefix_has_quote_ = false; | 59 title_prefix_has_quote_ = false; |
| 56 } | 60 } |
| 57 | 61 |
| 58 return title_prefix; | 62 return title_prefix; |
| 59 } | 63 } |
| OLD | NEW |