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

Unified Diff: ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm

Issue 2606873002: Move the offline URL trimming to GetFormattedURL. (Closed)
Patch Set: clean Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm b/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm
index af65aef02d7bdb81a92b30995dcce8cabdb2bb30..95b363de89d1484b68e1e00c1f49b6104dc52c3c 100644
--- a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm
+++ b/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm
@@ -9,6 +9,7 @@
#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h"
+#include "ios/chrome/browser/reading_list/offline_url_utils.h"
#import "ios/chrome/browser/tabs/tab.h"
#include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h"
#import "ios/web/public/web_state/web_state.h"
@@ -35,10 +36,6 @@ ToolbarModelImplIOS::ToolbarModelImplIOS(ToolbarModelDelegateIOS* delegate) {
ToolbarModelImplIOS::~ToolbarModelImplIOS() {}
-ToolbarModel* ToolbarModelImplIOS::GetToolbarModel() {
- return toolbar_model_.get();
-}
-
bool ToolbarModelImplIOS::IsLoading() {
// Please note, ToolbarModel's notion of isLoading is slightly different from
// WebState's IsLoading().
@@ -82,3 +79,38 @@ bool ToolbarModelImplIOS::ShouldDisplayHintText() {
Tab* currentTab = delegate_->GetCurrentTab();
return [currentTab.webController wantsLocationBarHintText];
}
+
+base::string16 ToolbarModelImplIOS::GetFormattedURL(size_t* prefix_end) const {
+ base::string16 formatted_url = toolbar_model_->GetFormattedURL(prefix_end);
+ Tab* currentTab = delegate_->GetCurrentTab();
Eugene But (OOO till 7-30) 2016/12/28 17:02:59 s/currentTab/current_tab Looks like existing code
Olivier 2016/12/29 12:37:20 Done.
+ if ([currentTab isOffline] &&
Eugene But (OOO till 7-30) 2016/12/28 17:03:00 If you choose not to add anything to Tab (which is
Olivier 2016/12/29 12:37:20 We need the URL, not the virtualURL. Done.
+ GetSecurityLevel(true) == security_state::SecurityLevel::NONE) {
Eugene But (OOO till 7-30) 2016/12/28 17:02:59 nit: GetSecurityLevel(true /*ignore_editing*/)
Olivier 2016/12/29 12:37:20 Done.
+ return reading_list::StripSchemeFromOnlineUrl(formatted_url);
+ }
+ return formatted_url;
+}
+
+GURL ToolbarModelImplIOS::GetURL() const {
+ return toolbar_model_->GetURL();
+}
+
+security_state::SecurityLevel ToolbarModelImplIOS::GetSecurityLevel(
+ bool ignore_editing) const {
+ return toolbar_model_->GetSecurityLevel(ignore_editing);
+}
+
+gfx::VectorIconId ToolbarModelImplIOS::GetVectorIcon() const {
+ return toolbar_model_->GetVectorIcon();
+}
+
+base::string16 ToolbarModelImplIOS::GetSecureVerboseText() const {
+ return toolbar_model_->GetSecureVerboseText();
+}
+
+base::string16 ToolbarModelImplIOS::GetEVCertName() const {
+ return toolbar_model_->GetEVCertName();
+}
+
+bool ToolbarModelImplIOS::ShouldDisplayURL() const {
+ return toolbar_model_->ShouldDisplayURL();
+}

Powered by Google App Engine
This is Rietveld 408576698