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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkEditActivity.java

Issue 2110543004: Move JNI bindings for url_formatter from chrome to //components/url_formatter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 package org.chromium.chrome.browser.bookmarks; 5 package org.chromium.chrome.browser.bookmarks;
6 6
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 import android.support.v7.widget.Toolbar; 9 import android.support.v7.widget.Toolbar;
10 import android.view.Menu; 10 import android.view.Menu;
11 import android.view.MenuItem; 11 import android.view.MenuItem;
12 import android.view.View; 12 import android.view.View;
13 import android.widget.TextView; 13 import android.widget.TextView;
14 14
15 import org.chromium.base.Log; 15 import org.chromium.base.Log;
16 import org.chromium.chrome.R; 16 import org.chromium.chrome.R;
17 import org.chromium.chrome.browser.SynchronousInitializationActivity; 17 import org.chromium.chrome.browser.SynchronousInitializationActivity;
18 import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkItem; 18 import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkItem;
19 import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkModelObserve r; 19 import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkModelObserve r;
20 import org.chromium.chrome.browser.util.UrlUtilities;
21 import org.chromium.chrome.browser.widget.EmptyAlertEditText; 20 import org.chromium.chrome.browser.widget.EmptyAlertEditText;
22 import org.chromium.chrome.browser.widget.TintedDrawable; 21 import org.chromium.chrome.browser.widget.TintedDrawable;
23 import org.chromium.components.bookmarks.BookmarkId; 22 import org.chromium.components.bookmarks.BookmarkId;
23 import org.chromium.components.url_formatter.UrlFormatter;
24 24
25 /** 25 /**
26 * The activity that enables the user to modify the title, url and parent folder of a bookmark. 26 * The activity that enables the user to modify the title, url and parent folder of a bookmark.
27 */ 27 */
28 public class BookmarkEditActivity extends SynchronousInitializationActivity { 28 public class BookmarkEditActivity extends SynchronousInitializationActivity {
29 /** The intent extra specifying the ID of the bookmark to be edited. */ 29 /** The intent extra specifying the ID of the bookmark to be edited. */
30 public static final String INTENT_BOOKMARK_ID = "BookmarkEditActivity.Bookma rkId"; 30 public static final String INTENT_BOOKMARK_ID = "BookmarkEditActivity.Bookma rkId";
31 31
32 private static final String TAG = "BookmarkEdit"; 32 private static final String TAG = "BookmarkEdit";
33 33
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 mModel.getBookmarkById(mBookmarkId).getUrl(); 135 mModel.getBookmarkById(mBookmarkId).getUrl();
136 final String title = mTitleEditText.getTrimmedText(); 136 final String title = mTitleEditText.getTrimmedText();
137 final String url = mUrlEditText.getTrimmedText(); 137 final String url = mUrlEditText.getTrimmedText();
138 138
139 if (!mTitleEditText.isEmpty()) { 139 if (!mTitleEditText.isEmpty()) {
140 mModel.setBookmarkTitle(mBookmarkId, title); 140 mModel.setBookmarkTitle(mBookmarkId, title);
141 } 141 }
142 142
143 if (!mUrlEditText.isEmpty() 143 if (!mUrlEditText.isEmpty()
144 && mModel.getBookmarkById(mBookmarkId).isUrlEditable()) { 144 && mModel.getBookmarkById(mBookmarkId).isUrlEditable()) {
145 String fixedUrl = UrlUtilities.fixupUrl(url); 145 String fixedUrl = UrlFormatter.fixupUrl(url);
146 if (fixedUrl != null && !fixedUrl.equals(originalUrl)) { 146 if (fixedUrl != null && !fixedUrl.equals(originalUrl)) {
147 mModel.setBookmarkUrl(mBookmarkId, fixedUrl); 147 mModel.setBookmarkUrl(mBookmarkId, fixedUrl);
148 } 148 }
149 } 149 }
150 } 150 }
151 151
152 super.onStop(); 152 super.onStop();
153 } 153 }
154 154
155 @Override 155 @Override
(...skipping 12 matching lines...) Expand all
168 Intent intent = new Intent(); 168 Intent intent = new Intent();
169 intent.putExtra(BookmarkActivity.INTENT_VISIT_BOOKMARK_ID, mBookmark Id.toString()); 169 intent.putExtra(BookmarkActivity.INTENT_VISIT_BOOKMARK_ID, mBookmark Id.toString());
170 setResult(RESULT_OK, intent); 170 setResult(RESULT_OK, intent);
171 } else { 171 } else {
172 BookmarkUtils.openBookmark( 172 BookmarkUtils.openBookmark(
173 mModel, this, mBookmarkId, BookmarkLaunchLocation.BOOKMARK_E DITOR); 173 mModel, this, mBookmarkId, BookmarkLaunchLocation.BOOKMARK_E DITOR);
174 } 174 }
175 finish(); 175 finish();
176 } 176 }
177 } 177 }
OLDNEW
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryAdapter.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698