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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_guest.h" 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" 10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bool* persist_storage) { 146 bool* persist_storage) {
147 std::string partition_str; 147 std::string partition_str;
148 if (!create_params.GetString(webview::kStoragePartitionId, &partition_str)) { 148 if (!create_params.GetString(webview::kStoragePartitionId, &partition_str)) {
149 return; 149 return;
150 } 150 }
151 151
152 // Since the "persist:" prefix is in ASCII, base::StartsWith will work fine on 152 // Since the "persist:" prefix is in ASCII, base::StartsWith will work fine on
153 // UTF-8 encoded |partition_id|. If the prefix is a match, we can safely 153 // UTF-8 encoded |partition_id|. If the prefix is a match, we can safely
154 // remove the prefix without splicing in the middle of a multi-byte codepoint. 154 // remove the prefix without splicing in the middle of a multi-byte codepoint.
155 // We can use the rest of the string as UTF-8 encoded one. 155 // We can use the rest of the string as UTF-8 encoded one.
156 if (base::StartsWithASCII(partition_str, "persist:", true)) { 156 if (base::StartsWith(partition_str, "persist:",
157 base::CompareCase::SENSITIVE)) {
157 size_t index = partition_str.find(":"); 158 size_t index = partition_str.find(":");
158 CHECK(index != std::string::npos); 159 CHECK(index != std::string::npos);
159 // It is safe to do index + 1, since we tested for the full prefix above. 160 // It is safe to do index + 1, since we tested for the full prefix above.
160 *storage_partition_id = partition_str.substr(index + 1); 161 *storage_partition_id = partition_str.substr(index + 1);
161 162
162 if (storage_partition_id->empty()) { 163 if (storage_partition_id->empty()) {
163 // TODO(lazyboy): Better way to deal with this error. 164 // TODO(lazyboy): Better way to deal with this error.
164 return; 165 return;
165 } 166 }
166 *persist_storage = true; 167 *persist_storage = true;
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 1451 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1451 DispatchEventToView( 1452 DispatchEventToView(
1452 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); 1453 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass()));
1453 } 1454 }
1454 // Since we changed fullscreen state, sending a Resize message ensures that 1455 // Since we changed fullscreen state, sending a Resize message ensures that
1455 // renderer/ sees the change. 1456 // renderer/ sees the change.
1456 web_contents()->GetRenderViewHost()->WasResized(); 1457 web_contents()->GetRenderViewHost()->WasResized();
1457 } 1458 }
1458 1459
1459 } // namespace extensions 1460 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_apitest.cc ('k') | extensions/browser/warning_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698