diff --git a/AUTHORS b/AUTHORS index 7d172b41..ece7b0d4 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -829,3 +829,4 @@ ARM Holdings <*@arm.com> Macadamian <*@macadamian.com> IBM Inc. <*@*.ibm.com> +Akamai Inc. <*@akamai.com>
diff --git a/DEPS b/DEPS index 308a11b..504498a 100644 --- a/DEPS +++ b/DEPS
@@ -40,11 +40,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '875218ebd816eb8931c64c5018ce2dc9bc8fd695', + 'skia_revision': 'e30f758525e39079dbfb5f8a8cf0c48898da10b1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '1539c3a15a256290a6a2f1afcb6afc9d226ceda3', + 'v8_revision': 'b1ebf000b0b9043e8a5d8ae0404fbc2da8121e64', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -241,7 +241,7 @@ Var('chromium_git') + '/external/github.com/open-source-parsers/jsoncpp.git' + '@' + 'f572e8e42e22cfcf5ab0aea26574f408943edfa4', # from svn 248 'src/third_party/libyuv': - Var('chromium_git') + '/libyuv/libyuv.git' + '@' + 'b18fd21d3c27fce69b5c1ed44b89131dedc87284', # from r1637 + Var('chromium_git') + '/libyuv/libyuv.git' + '@' + '45b176d153c61732d81b2df0109bd292e67d2b6b', # from r1645 'src/third_party/smhasher/src': Var('chromium_git') + '/external/smhasher.git' + '@' + 'e87738e57558e0ec472b2fc3a643b838e5b6e88f', @@ -363,7 +363,7 @@ Var('chromium_git') + '/external/github.com/swisspol/GCDWebServer.git' + '@' + '43555c66627f6ed44817855a0f6d465f559d30e0', 'src/ios/third_party/material_components_ios/src': - Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '2fe5887b69b53ebf78966cc764aadd39c750f453', + Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '6752ec5219edd41b625a39f58793df3663cc5861', 'src/ios/third_party/material_font_disk_loader_ios/src': Var('chromium_git') + '/external/github.com/material-foundation/material-font-disk-loader-ios.git' + '@' + '8e30188777b016182658fbaa0a4a020a48183224',
diff --git a/android_webview/browser/aw_metrics_service_client.h b/android_webview/browser/aw_metrics_service_client.h index 82ac198f..e45fb128 100644 --- a/android_webview/browser/aw_metrics_service_client.h +++ b/android_webview/browser/aw_metrics_service_client.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ -#define ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ +#ifndef ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_H_ +#define ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_H_ #include "components/metrics/enabled_state_provider.h" #include "components/metrics/metrics_service_client.h" @@ -38,4 +38,4 @@ } // namespace android_webview -#endif // ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ +#endif // ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_H_
diff --git a/android_webview/native/aw_metrics_service_client_impl.h b/android_webview/native/aw_metrics_service_client_impl.h index 1d5ca2f..6d42f1d 100644 --- a/android_webview/native/aw_metrics_service_client_impl.h +++ b/android_webview/native/aw_metrics_service_client_impl.h
@@ -79,4 +79,4 @@ } // namespace android_webview -#endif // ANDROID_WEBVIEW_NATIVE_AW_METRICS_SWITCH_ +#endif // ANDROID_WEBVIEW_NATIVE_AW_METRICS_SERVICE_CLIENT_IMPL_
diff --git a/base/BUILD.gn b/base/BUILD.gn index 5f1b6d0e3..66d31ad 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -2009,6 +2009,7 @@ "message_loop/message_loop_unittest.cc", "message_loop/message_pump_glib_unittest.cc", "message_loop/message_pump_io_ios_unittest.cc", + "message_loop/message_pump_mac_unittest.cc", "metrics/bucket_ranges_unittest.cc", "metrics/field_trial_params_unittest.cc", "metrics/field_trial_unittest.cc",
diff --git a/base/message_loop/message_pump_mac.h b/base/message_loop/message_pump_mac.h index 14b8377..f0766eb8 100644 --- a/base/message_loop/message_pump_mac.h +++ b/base/message_loop/message_pump_mac.h
@@ -78,9 +78,11 @@ typedef NSAutoreleasePool AutoreleasePoolType; #endif // !defined(__OBJC__) || __has_feature(objc_arc) -class MessagePumpCFRunLoopBase : public MessagePump { +class BASE_EXPORT MessagePumpCFRunLoopBase : public MessagePump { // Needs access to CreateAutoreleasePool. friend class MessagePumpScopedAutoreleasePool; + friend class TestMessagePumpCFRunLoopBase; + public: MessagePumpCFRunLoopBase(); ~MessagePumpCFRunLoopBase() override; @@ -113,6 +115,21 @@ virtual AutoreleasePoolType* CreateAutoreleasePool(); private: + // Marking timers as invalid at the right time helps significantly reduce + // power use (see the comment in RunDelayedWorkTimer()), however there is no + // public API for doing so. CFRuntime.h states that CFRuntimeBase, upon which + // the above timer invalidation functions are based, can change from release + // to release and should not be accessed directly (this struct last changed at + // least in 2008 in CF-476). + // + // This function uses private API to modify a test timer's valid state and + // uses public API to confirm that the private API changed the right bit. + static bool CanInvalidateCFRunLoopTimers(); + + // Sets a Core Foundation object's "invalid" bit to |valid|. Based on code + // from CFRunLoop.c. + static void ChromeCFRunLoopTimerSetValid(CFRunLoopTimerRef timer, bool valid); + // Timer callback scheduled by ScheduleDelayedWork. This does not do any // work, but it signals work_source_ so that delayed work can be performed // within the appropriate priority constraints.
diff --git a/base/message_loop/message_pump_mac.mm b/base/message_loop/message_pump_mac.mm index d924ead..82d9f1e8 100644 --- a/base/message_loop/message_pump_mac.mm +++ b/base/message_loop/message_pump_mac.mm
@@ -69,7 +69,48 @@ // Set to true if MessagePumpMac::Create() is called before NSApp is // initialized. Only accessed from the main thread. bool g_not_using_cr_app = false; + +// Various CoreFoundation definitions. +typedef struct __CFRuntimeBase { + uintptr_t _cfisa; + uint8_t _cfinfo[4]; +#if __LP64__ + uint32_t _rc; #endif +} CFRuntimeBase; + +#if defined(__BIG_ENDIAN__) +#define __CF_BIG_ENDIAN__ 1 +#define __CF_LITTLE_ENDIAN__ 0 +#endif + +#if defined(__LITTLE_ENDIAN__) +#define __CF_LITTLE_ENDIAN__ 1 +#define __CF_BIG_ENDIAN__ 0 +#endif + +#define CF_INFO_BITS (!!(__CF_BIG_ENDIAN__)*3) + +#define __CFBitfieldMask(N1, N2) \ + ((((UInt32)~0UL) << (31UL - (N1) + (N2))) >> (31UL - N1)) +#define __CFBitfieldSetValue(V, N1, N2, X) \ + ((V) = ((V) & ~__CFBitfieldMask(N1, N2)) | \ + (((X) << (N2)) & __CFBitfieldMask(N1, N2))) + +// Marking timers as invalid at the right time by flipping their valid bit helps +// significantly reduce power use (see the explanation in +// RunDelayedWorkTimer()), however there is no public API for doing so. +// CFRuntime.h states that CFRuntimeBase can change from release to release +// and should not be accessed directly. The last known change of this struct +// occurred in 2008 in CF-476 / 10.5; unfortunately the source for 10.11 and +// 10.12 is not available for inspection at this time. +// CanInvalidateCFRunLoopTimers() will at least prevent us from invalidating +// timers if this function starts flipping the wrong bit on a future OS release. +void __ChromeCFRunLoopTimerSetValid(CFRunLoopTimerRef timer, bool valid) { + __CFBitfieldSetValue(((CFRuntimeBase*)timer)->_cfinfo[CF_INFO_BITS], 3, 3, + valid); +} +#endif // !defined(OS_IOS) } // namespace @@ -94,6 +135,47 @@ DISALLOW_COPY_AND_ASSIGN(MessagePumpScopedAutoreleasePool); }; +#if !defined(OS_IOS) +// This function uses private API to modify a test timer's valid state and +// uses public API to confirm that the private API changed the correct bit. +// static +bool MessagePumpCFRunLoopBase::CanInvalidateCFRunLoopTimers() { + CFRunLoopTimerContext timer_context = CFRunLoopTimerContext(); + timer_context.info = nullptr; + ScopedCFTypeRef<CFRunLoopTimerRef> test_timer( + CFRunLoopTimerCreate(NULL, // allocator + kCFTimeIntervalMax, // fire time + kCFTimeIntervalMax, // interval + 0, // flags + 0, // priority + nullptr, &timer_context)); + // Should be valid from the start. + if (!CFRunLoopTimerIsValid(test_timer)) { + return false; + } + // Confirm that the private API can mark the timer invalid. + __ChromeCFRunLoopTimerSetValid(test_timer, false); + if (CFRunLoopTimerIsValid(test_timer)) { + return false; + } + // Confirm that the private API can mark the timer valid. + __ChromeCFRunLoopTimerSetValid(test_timer, true); + return CFRunLoopTimerIsValid(test_timer); +} +#endif // !defined(OS_IOS) + +// static +void MessagePumpCFRunLoopBase::ChromeCFRunLoopTimerSetValid( + CFRunLoopTimerRef timer, + bool valid) { +#if !defined(OS_IOS) + static bool can_invalidate_timers = CanInvalidateCFRunLoopTimers(); + if (can_invalidate_timers) { + __ChromeCFRunLoopTimerSetValid(timer, valid); + } +#endif // !defined(OS_IOS) +} + // Must be called on the run loop thread. MessagePumpCFRunLoopBase::MessagePumpCFRunLoopBase() : delegate_(NULL), @@ -243,6 +325,17 @@ const TimeTicks& delayed_work_time) { TimeDelta delta = delayed_work_time - TimeTicks::Now(); delayed_work_fire_time_ = CFAbsoluteTimeGetCurrent() + delta.InSecondsF(); + + // Flip the timer's validation bit just before setting the new fire time. Do + // this now because CFRunLoopTimerSetNextFireDate() likely checks the validity + // of a timer before proceeding to set its fire date. Making the timer valid + // now won't have any side effects (such as a premature firing of the timer) + // because we're only flipping a bit. + // + // Please see the comment in RunDelayedWorkTimer() for more info on the whys + // of invalidation. + ChromeCFRunLoopTimerSetValid(delayed_work_timer_, true); + CFRunLoopTimerSetNextFireDate(delayed_work_timer_, delayed_work_fire_time_); if (timer_slack_ == TIMER_SLACK_MAXIMUM) { CFRunLoopTimerSetTolerance(delayed_work_timer_, delta.InSecondsF() * 0.5); @@ -264,6 +357,31 @@ // The timer won't fire again until it's reset. self->delayed_work_fire_time_ = kCFTimeIntervalMax; + // The message pump's timer needs to fire at changing and unpredictable + // intervals. Creating a new timer for each firing time is very expensive, so + // the message pump instead uses a repeating timer with a very large repeat + // rate. After each firing of the timer, the run loop sets the timer's next + // firing time to the distant future, essentially pausing the timer until the + // pump sets the next firing time. This is the solution recommended by Apple. + // + // It turns out, however, that scheduling timers is also quite expensive, and + // that every one of the message pump's timer firings incurs two + // reschedulings. The first rescheduling occurs in ScheduleDelayedWork(), + // which sets the desired next firing time. The second comes after exiting + // this method (the timer's callback method), when the run loop sets the + // timer's next firing time to far in the future. + // + // The code in __CFRunLoopDoTimer() inside CFRunLoop.c calls the timer's + // callback, confirms that the timer is valid, and then sets its future + // firing time based on its repeat frequency. Flipping the valid bit here + // causes the __CFRunLoopDoTimer() to skip setting the future firing time. + // Note that there's public API to invalidate a timer but it goes beyond + // flipping the valid bit, making the timer unusable in the future. + // + // ScheduleDelayedWork() flips the valid bit back just before setting the + // timer's new firing time. + ChromeCFRunLoopTimerSetValid(self->delayed_work_timer_, false); + // CFRunLoopTimers fire outside of the priority scheme for CFRunLoopSources. // In order to establish the proper priority in which work and delayed work // are processed one for one, the timer used to schedule delayed work must
diff --git a/base/message_loop/message_pump_mac_unittest.cc b/base/message_loop/message_pump_mac_unittest.cc new file mode 100644 index 0000000..17c70c8 --- /dev/null +++ b/base/message_loop/message_pump_mac_unittest.cc
@@ -0,0 +1,108 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/message_loop/message_pump_mac.h" + +#include "base/mac/scoped_cftyperef.h" +#include "base/macros.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace base { + +class TestMessagePumpCFRunLoopBase { + public: + bool TestCanInvalidateTimers() { + return MessagePumpCFRunLoopBase::CanInvalidateCFRunLoopTimers(); + } + static void SetTimerValid(CFRunLoopTimerRef timer, bool valid) { + MessagePumpCFRunLoopBase::ChromeCFRunLoopTimerSetValid(timer, valid); + } + + static void PerformTimerCallback(CFRunLoopTimerRef timer, void* info) { + TestMessagePumpCFRunLoopBase* self = + static_cast<TestMessagePumpCFRunLoopBase*>(info); + self->timer_callback_called_ = true; + + if (self->invalidate_timer_in_callback_) { + SetTimerValid(timer, false); + } + } + + bool invalidate_timer_in_callback_; + + bool timer_callback_called_; +}; + +TEST(MessagePumpMacTest, TestCanInvalidateTimers) { + TestMessagePumpCFRunLoopBase message_pump_test; + + // Catch whether or not the use of private API ever starts failing. + EXPECT_TRUE(message_pump_test.TestCanInvalidateTimers()); +} + +TEST(MessagePumpMacTest, TestInvalidatedTimerReuse) { + TestMessagePumpCFRunLoopBase message_pump_test; + + CFRunLoopTimerContext timer_context = CFRunLoopTimerContext(); + timer_context.info = &message_pump_test; + const CFTimeInterval kCFTimeIntervalMax = + std::numeric_limits<CFTimeInterval>::max(); + ScopedCFTypeRef<CFRunLoopTimerRef> test_timer(CFRunLoopTimerCreate( + NULL, // allocator + kCFTimeIntervalMax, // fire time + kCFTimeIntervalMax, // interval + 0, // flags + 0, // priority + TestMessagePumpCFRunLoopBase::PerformTimerCallback, &timer_context)); + CFRunLoopAddTimer(CFRunLoopGetCurrent(), test_timer, + kMessageLoopExclusiveRunLoopMode); + + // Sanity check. + EXPECT_TRUE(CFRunLoopTimerIsValid(test_timer)); + + // Confirm that the timer fires as expected, and that it's not a one-time-use + // timer (those timers are invalidated after they fire). + CFAbsoluteTime next_fire_time = CFAbsoluteTimeGetCurrent() + 0.01; + CFRunLoopTimerSetNextFireDate(test_timer, next_fire_time); + message_pump_test.timer_callback_called_ = false; + message_pump_test.invalidate_timer_in_callback_ = false; + CFRunLoopRunInMode(kMessageLoopExclusiveRunLoopMode, 0.02, true); + EXPECT_TRUE(message_pump_test.timer_callback_called_); + EXPECT_TRUE(CFRunLoopTimerIsValid(test_timer)); + + // As a repeating timer, the timer should have a new fire date set in the + // future. + EXPECT_GT(CFRunLoopTimerGetNextFireDate(test_timer), next_fire_time); + + // Try firing the timer, and invalidating it within its callback. + next_fire_time = CFAbsoluteTimeGetCurrent() + 0.01; + CFRunLoopTimerSetNextFireDate(test_timer, next_fire_time); + message_pump_test.timer_callback_called_ = false; + message_pump_test.invalidate_timer_in_callback_ = true; + CFRunLoopRunInMode(kMessageLoopExclusiveRunLoopMode, 0.02, true); + EXPECT_TRUE(message_pump_test.timer_callback_called_); + EXPECT_FALSE(CFRunLoopTimerIsValid(test_timer)); + + // The CFRunLoop believes the timer is invalid, so it should not have a + // fire date. + EXPECT_EQ(0, CFRunLoopTimerGetNextFireDate(test_timer)); + + // Now mark the timer as valid and confirm that it still fires correctly. + TestMessagePumpCFRunLoopBase::SetTimerValid(test_timer, true); + EXPECT_TRUE(CFRunLoopTimerIsValid(test_timer)); + next_fire_time = CFAbsoluteTimeGetCurrent() + 0.01; + CFRunLoopTimerSetNextFireDate(test_timer, next_fire_time); + message_pump_test.timer_callback_called_ = false; + message_pump_test.invalidate_timer_in_callback_ = false; + CFRunLoopRunInMode(kMessageLoopExclusiveRunLoopMode, 0.02, true); + EXPECT_TRUE(message_pump_test.timer_callback_called_); + EXPECT_TRUE(CFRunLoopTimerIsValid(test_timer)); + + // Confirm that the run loop again gave it a new fire date in the future. + EXPECT_GT(CFRunLoopTimerGetNextFireDate(test_timer), next_fire_time); + + CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), test_timer, + kMessageLoopExclusiveRunLoopMode); +} +} // namespace base
diff --git a/base/task_scheduler/post_task.cc b/base/task_scheduler/post_task.cc index 3cf075d..a1a3bc2 100644 --- a/base/task_scheduler/post_task.cc +++ b/base/task_scheduler/post_task.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "base/logging.h" #include "base/task_scheduler/task_scheduler.h" #include "base/threading/post_task_and_reply_impl.h" @@ -58,6 +59,8 @@ const TaskTraits& traits, const Closure& task, TimeDelta delay) { + DCHECK(TaskScheduler::GetInstance()) + << "Ref. Prerequisite section of post_task.h"; TaskScheduler::GetInstance()->PostDelayedTaskWithTraits(from_here, traits, task, delay); } @@ -71,17 +74,23 @@ } scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) { + DCHECK(TaskScheduler::GetInstance()) + << "Ref. Prerequisite section of post_task.h"; return TaskScheduler::GetInstance()->CreateTaskRunnerWithTraits(traits); } scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( const TaskTraits& traits) { + DCHECK(TaskScheduler::GetInstance()) + << "Ref. Prerequisite section of post_task.h"; return TaskScheduler::GetInstance()->CreateSequencedTaskRunnerWithTraits( traits); } scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( const TaskTraits& traits) { + DCHECK(TaskScheduler::GetInstance()) + << "Ref. Prerequisite section of post_task.h"; return TaskScheduler::GetInstance()->CreateSingleThreadTaskRunnerWithTraits( traits); }
diff --git a/base/task_scheduler/post_task.h b/base/task_scheduler/post_task.h index 8b3e7df..3174f06d 100644 --- a/base/task_scheduler/post_task.h +++ b/base/task_scheduler/post_task.h
@@ -23,9 +23,6 @@ // This is the preferred interface to post tasks to the TaskScheduler. // -// TaskScheduler must have been registered for the current process via -// TaskScheduler::SetInstance() before the functions below are valid. -// // To post a simple one-off task with default traits: // PostTask(FROM_HERE, Bind(...)); // @@ -62,6 +59,13 @@ // registered TaskScheduler (i.e. not on the main thread). Tasks posted through // functions below with a delay may be coalesced (i.e. delays may be adjusted to // reduce the number of wakeups and hence power consumption). +// +// Prerequisite: A TaskScheduler must have been registered for the current +// process via TaskScheduler::SetInstance() before the functions below are +// valid. This is typically done during the initialization phase in each +// process. If your code is not running in that phase, you most likely don't +// have to worry about this. You will encounter DCHECKs or nullptr dereferences +// if this is violated. For tests, prefer base::test::ScopedTaskScheduler. // Posts |task| to the TaskScheduler. Calling this is equivalent to calling // PostTaskWithTraits with plain TaskTraits.
diff --git a/base/task_scheduler/task_scheduler.h b/base/task_scheduler/task_scheduler.h index 296e40b..da2cb79 100644 --- a/base/task_scheduler/task_scheduler.h +++ b/base/task_scheduler/task_scheduler.h
@@ -108,25 +108,36 @@ // new TaskScheduler. // Creates and sets a task scheduler with one worker pool that can have up to - // |max_threads| threads. CHECKs on failure. + // |max_threads| threads. CHECKs on failure. For tests, prefer + // base::test::ScopedTaskScheduler (ensures isolation). static void CreateAndSetSimpleTaskScheduler(int max_threads); // Creates and sets a task scheduler with custom worker pools. CHECKs on // failure. |worker_pool_params_vector| describes the worker pools to create. // |worker_pool_index_for_traits_callback| returns the index in |worker_pools| - // of the worker pool in which a task with given traits should run. + // of the worker pool in which a task with given traits should run. For tests, + // prefer base::test::ScopedTaskScheduler (ensures isolation). static void CreateAndSetDefaultTaskScheduler( const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector, const WorkerPoolIndexForTraitsCallback& worker_pool_index_for_traits_callback); // Registers |task_scheduler| to handle tasks posted through the post_task.h - // API for this process. + // API for this process. For tests, prefer base::test::ScopedTaskScheduler + // (ensures isolation). static void SetInstance(std::unique_ptr<TaskScheduler> task_scheduler); - // Retrieve the TaskScheduler set via CreateAndSetDefaultTaskScheduler() or - // SetInstance(). This should be used very rarely; most users of TaskScheduler - // should use the post_task.h API. + // Retrieve the TaskScheduler set via SetInstance() or + // CreateAndSet(Simple|Default)TaskScheduler(). This should be used very + // rarely; most users of TaskScheduler should use the post_task.h API. In + // particular, refrain from doing + // if (!TaskScheduler::GetInstance()) { + // TaskScheduler::SetInstance(...); + // base::PostTask(...); + // } + // instead make sure to SetInstance() early in one determinstic place in the + // process' initialization phase. + // In doubt, consult with //base/task_scheduler/OWNERS. static TaskScheduler* GetInstance(); private:
diff --git a/base/task_scheduler/task_traits.h b/base/task_scheduler/task_traits.h index c2e3728..435fdac 100644 --- a/base/task_scheduler/task_traits.h +++ b/base/task_scheduler/task_traits.h
@@ -127,7 +127,7 @@ // removing usage of methods listed above in the labeled tasks would still // result in tasks that may block (per MayBlock()'s definition). // - // In doubt, consult with base/task_scheduler/OWNERS. + // In doubt, consult with //base/task_scheduler/OWNERS. TaskTraits& WithBaseSyncPrimitives(); // Applies |priority| to tasks with these traits.
diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py index df5325f..8ab8ea0 100755 --- a/build/android/gyp/javac.py +++ b/build/android/gyp/javac.py
@@ -94,9 +94,7 @@ def _ConvertToJMakeArgs(javac_cmd, pdb_path): - new_args = ['bin/jmake', '-pdb', pdb_path] - if javac_cmd[0] != 'javac': - new_args.extend(('-jcexec', new_args[0])) + new_args = ['bin/jmake', '-pdb', pdb_path, '-jcexec', javac_cmd[0]] if md5_check.PRINT_EXPLANATIONS: new_args.append('-Xtiming') @@ -420,9 +418,12 @@ java_files = _FilterJavaFiles(java_files, options.javac_includes) - javac_cmd = ['javac'] if options.use_errorprone_path: - javac_cmd = [options.use_errorprone_path] + ERRORPRONE_OPTIONS + javac_path = options.use_errorprone_path + javac_cmd = [javac_path] + ERRORPRONE_OPTIONS + else: + javac_path = distutils.spawn.find_executable('javac') + javac_cmd = [javac_path] javac_cmd.extend(( '-g', @@ -473,8 +474,10 @@ else: classpath_inputs.append(path) - # Compute the list of paths that when changed, we need to rebuild. - input_paths = classpath_inputs + options.java_srcjars + java_files + # GN already knows of java_files, so listing them just make things worse when + # they change. + depfile_deps = [javac_path] + classpath_inputs + options.java_srcjars + input_paths = depfile_deps + java_files output_paths = [ options.jar_path, @@ -493,6 +496,7 @@ lambda changes: _OnStaleMd5(changes, options, javac_cmd, java_files, classpath_inputs), options, + depfile_deps=depfile_deps, input_paths=input_paths, input_strings=javac_cmd, output_paths=output_paths,
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 8f57120..9137028 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -1084,7 +1084,10 @@ "-Wno-shift-negative-value", ] } - if (!is_nacl && !use_xcode_clang) { + + # use_xcode_clang only refers to the iOS toolchain, host binaries use + # chromium's clang always. + if (!is_nacl && (!use_xcode_clang || current_toolchain == host_toolchain)) { # Flags NaCl (Clang 3.7) and Xcode 7.3 (Clang clang-703.0.31) do not # recognize. cflags += [ @@ -1099,16 +1102,13 @@ # TODO(thakis): Consider turning this on, https://crbug.com/691120 "-Wno-block-capture-autoreleasing", - ] - if (llvm_force_head_revision) { - cflags += [ - # TODO(hans): https://crbug.com/681136 - "-Wno-unused-lambda-capture", - # TODO(thakis ): https://crbug.com/683349 - "-Wno-user-defined-warnings", - ] - } + # TODO(hans): https://crbug.com/681136 + "-Wno-unused-lambda-capture", + + # TODO(thakis ): https://crbug.com/683349 + "-Wno-user-defined-warnings", + ] } } }
diff --git a/build/nocompile.gni b/build/nocompile.gni index 7c91c67..a113c384 100644 --- a/build/nocompile.gni +++ b/build/nocompile.gni
@@ -59,7 +59,9 @@ declare_args() { # TODO(crbug.com/105388): make sure no-compile test is not flaky. - enable_nocompile_tests = is_linux && is_clang && host_cpu == target_cpu + # TODO(crbug.com/695991): reenable if + # is_linux && is_clang && host_cpu == target_cpu + enable_nocompile_tests = false } if (enable_nocompile_tests) {
diff --git a/build/toolchain/toolchain.gni b/build/toolchain/toolchain.gni index 5722c12..6eb3c908 100644 --- a/build/toolchain/toolchain.gni +++ b/build/toolchain/toolchain.gni
@@ -50,12 +50,7 @@ declare_args() { if (is_clang) { # Clang compiler version. Clang files are placed at version-dependent paths. - if (llvm_force_head_revision) { - clang_version = "5.0.0" - } else { - # TODO(thakis): Remove this branch the next time clang rolls. - clang_version = "4.0.0" - } + clang_version = "5.0.0" } }
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 83aaa006..dd900f8 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc
@@ -547,7 +547,8 @@ // TODO(ccameron): This will always return false on pixel tests, which // makes it un-test-able until we upgrade Mesa. // https://crbug.com/687720 - return caps.texture_half_float_linear && caps.color_buffer_float; + return caps.texture_half_float_linear && + caps.color_buffer_half_float_rgba; } NOTREACHED();
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 96939835..090f0d5 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -10687,7 +10687,7 @@ scroll_parent2.scroll_clip_layer_bounds = root1->bounds(); scroll_parent2.bounds = parent2->bounds(); scroll_parent2.max_scroll_offset_affected_by_page_scale = true; - scroll_parent2.is_inner_viewport_scroll_layer = true; + scroll_parent2.scrolls_inner_viewport = true; scroll_parent2.user_scrollable_horizontal = true; scroll_parent2.user_scrollable_vertical = true; scroll_parent2.transform_id = parent2->transform_tree_index();
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 234ad1d..bd9d482b 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -2600,11 +2600,9 @@ // notifications. We use the viewport's main scroll layer to represent the // viewport in scrolling code. bool scrolls_inner_viewport = - impl_scroll_node && InnerViewportScrollLayer() && - InnerViewportScrollLayer()->scroll_tree_index() == impl_scroll_node->id; + impl_scroll_node && impl_scroll_node->scrolls_inner_viewport; bool scrolls_outer_viewport = - impl_scroll_node && OuterViewportScrollLayer() && - OuterViewportScrollLayer()->scroll_tree_index() == impl_scroll_node->id; + impl_scroll_node && impl_scroll_node->scrolls_outer_viewport; if (!impl_scroll_node || scrolls_inner_viewport || scrolls_outer_viewport) { if (auto* mainScrollLayer = viewport()->MainScrollLayer()) impl_scroll_node = scroll_tree.Node(mainScrollLayer->scroll_tree_index()); @@ -3048,11 +3046,9 @@ // element that's not a descendant of the document.rootScroller. In that case // we want to scroll the inner viewport -- to allow panning while zoomed -- // but also move browser controls if needed. - bool scrolls_inner_viewport_layer = - InnerViewportScrollLayer() && - InnerViewportScrollLayer()->scroll_tree_index() == scroll_node->id; + bool scrolls_inner_viewport = scroll_node->scrolls_inner_viewport; - if (scrolls_main_viewport_scroll_layer || scrolls_inner_viewport_layer) { + if (scrolls_main_viewport_scroll_layer || scrolls_inner_viewport) { Viewport::ScrollResult result = viewport()->ScrollBy( delta, viewport_point, scroll_state->is_direct_manipulation(), !wheel_scrolling_, scrolls_main_viewport_scroll_layer); @@ -3078,7 +3074,7 @@ return; } - if (!scrolls_main_viewport_scroll_layer && !scrolls_inner_viewport_layer) { + if (!scrolls_main_viewport_scroll_layer && !scrolls_inner_viewport) { // If the applied delta is within 45 degrees of the input // delta, bail out to make it easier to scroll just one layer // in one direction without affecting any of its parents.
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc index 577903d..9a2ef5b 100644 --- a/cc/trees/property_tree.cc +++ b/cc/trees/property_tree.cc
@@ -1209,7 +1209,7 @@ gfx::SizeF scroll_bounds = gfx::SizeF(scroll_node->bounds.width(), scroll_node->bounds.height()); - if (scroll_node->is_inner_viewport_scroll_layer) { + if (scroll_node->scrolls_inner_viewport) { scroll_bounds.Enlarge( property_trees()->inner_viewport_scroll_bounds_delta().x(), property_trees()->inner_viewport_scroll_bounds_delta().y()); @@ -1259,10 +1259,10 @@ gfx::Size scroll_clip_layer_bounds = scroll_node->scroll_clip_layer_bounds; gfx::Vector2dF scroll_clip_layer_bounds_delta; - if (scroll_node->is_inner_viewport_scroll_layer) { + if (scroll_node->scrolls_inner_viewport) { scroll_clip_layer_bounds_delta.Add( property_trees()->inner_viewport_container_bounds_delta()); - } else if (scroll_node->is_outer_viewport_scroll_layer) { + } else if (scroll_node->scrolls_outer_viewport) { scroll_clip_layer_bounds_delta.Add( property_trees()->outer_viewport_container_bounds_delta()); }
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc index af02c5f..d620e0f 100644 --- a/cc/trees/property_tree_builder.cc +++ b/cc/trees/property_tree_builder.cc
@@ -751,10 +751,10 @@ // need to have their local transform updated when the inner / outer // viewport bounds change, but do not unconditionally move by that delta // like fixed position nodes. - if (scroll_ancestor->is_inner_viewport_scroll_layer) { + if (scroll_ancestor->scrolls_inner_viewport) { data_for_children->property_trees->transform_tree .AddNodeAffectedByInnerViewportBoundsDelta(node->id); - } else if (scroll_ancestor->is_outer_viewport_scroll_layer) { + } else if (scroll_ancestor->scrolls_outer_viewport) { data_for_children->property_trees->transform_tree .AddNodeAffectedByOuterViewportBoundsDelta(node->id); } @@ -1178,9 +1178,9 @@ } node.scroll_clip_layer_bounds = clip_bounds; - node.is_inner_viewport_scroll_layer = + node.scrolls_inner_viewport = layer == data_from_ancestor.inner_viewport_scroll_layer; - node.is_outer_viewport_scroll_layer = + node.scrolls_outer_viewport = layer == data_from_ancestor.outer_viewport_scroll_layer; node.bounds = layer->bounds();
diff --git a/cc/trees/scroll_node.cc b/cc/trees/scroll_node.cc index 18b5d42..ef3498a 100644 --- a/cc/trees/scroll_node.cc +++ b/cc/trees/scroll_node.cc
@@ -21,8 +21,8 @@ MainThreadScrollingReason::kNotScrollingOnMain), contains_non_fast_scrollable_region(false), max_scroll_offset_affected_by_page_scale(false), - is_inner_viewport_scroll_layer(false), - is_outer_viewport_scroll_layer(false), + scrolls_inner_viewport(false), + scrolls_outer_viewport(false), should_flatten(false), user_scrollable_horizontal(false), user_scrollable_vertical(false), @@ -41,10 +41,8 @@ bounds == other.bounds && max_scroll_offset_affected_by_page_scale == other.max_scroll_offset_affected_by_page_scale && - is_inner_viewport_scroll_layer == - other.is_inner_viewport_scroll_layer && - is_outer_viewport_scroll_layer == - other.is_outer_viewport_scroll_layer && + scrolls_inner_viewport == other.scrolls_inner_viewport && + scrolls_outer_viewport == other.scrolls_outer_viewport && offset_to_transform_parent == other.offset_to_transform_parent && should_flatten == other.should_flatten && user_scrollable_horizontal == other.user_scrollable_horizontal &&
diff --git a/cc/trees/scroll_node.h b/cc/trees/scroll_node.h index 3e4f4e9..19e29f4 100644 --- a/cc/trees/scroll_node.h +++ b/cc/trees/scroll_node.h
@@ -47,8 +47,8 @@ gfx::Size bounds; bool max_scroll_offset_affected_by_page_scale; - bool is_inner_viewport_scroll_layer; - bool is_outer_viewport_scroll_layer; + bool scrolls_inner_viewport; + bool scrolls_outer_viewport; // This offset is used when |scrollable| is false and there isn't a transform // node already present that covers this offset.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java index bcc2c8b..69b8aad 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
@@ -1819,6 +1819,11 @@ } } + /** TODO(dfalcantara): Revisit after M58. */ + protected boolean allowsEmptySearchQueries() { + return false; + } + /** * Sets the query string in the omnibox (ensuring the URL bar has focus and triggering * autocomplete for the specified query) as if the user typed it. @@ -1826,7 +1831,7 @@ * @param query The query to be set in the omnibox. */ public void setSearchQuery(final String query) { - if (TextUtils.isEmpty(query)) return; + if (!allowsEmptySearchQueries() && TextUtils.isEmpty(query)) return; if (!mNativeInitialized) { mDeferredNativeRunnables.add(new Runnable() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/RouterTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/RouterTestUtils.java index 8c82769..77300942 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/RouterTestUtils.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/RouterTestUtils.java
@@ -5,20 +5,15 @@ package org.chromium.chrome.browser.media; import android.app.Dialog; -import android.app.Instrumentation; -import android.os.SystemClock; import android.support.v4.app.DialogFragment; import android.support.v4.app.FragmentManager; -import android.view.MotionEvent; import android.view.View; import org.chromium.base.Log; -import org.chromium.base.ThreadUtils; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.CriteriaHelper; -import org.chromium.content.browser.test.util.TestTouchUtils; import java.util.ArrayList; import java.util.concurrent.Callable; @@ -110,88 +105,4 @@ return null; } } - - /** - * Click a button. Unlike {@link RouterTestUtils#mouseSingleClickView} this directly accesses - * the view and does not send motion events though the message queue. As such it doesn't require - * the view to have been created by the instrumented activity, but gives less flexibility than - * mouseSingleClickView. For example, if the view is hierachical, then clickButton will always - * act on specified view, whereas mouseSingleClickView will send the events to the appropriate - * child view. It is hence only really appropriate for simple views such as buttons. - * - * @param button the button to be clicked. - */ - public static void clickButton(final View button) { - ThreadUtils.runOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - // Post the actual click to the button's message queue, to ensure that it has been - // inflated before the click is received. - button.post(new Runnable() { - @Override - public void run() { - button.performClick(); - } - }); - } - }); - } - - private static void sendMouseAction(Instrumentation instrumentation, int action, long downTime, - float x, float y) { - long eventTime = SystemClock.uptimeMillis(); - MotionEvent.PointerCoords coords[] = new MotionEvent.PointerCoords[1]; - coords[0] = new MotionEvent.PointerCoords(); - coords[0].x = x; - coords[0].y = y; - MotionEvent.PointerProperties properties[] = new MotionEvent.PointerProperties[1]; - properties[0] = new MotionEvent.PointerProperties(); - properties[0].id = 0; - properties[0].toolType = MotionEvent.TOOL_TYPE_FINGER; - MotionEvent event = MotionEvent.obtain(downTime, eventTime, action, 1, properties, coords, - 0, 0, 0.0f, 0.0f, 0, 0, 0, 0); - instrumentation.sendPointerSync(event); - instrumentation.waitForIdleSync(); - } - - /** - * Sends (synchronously) a single mouse click to an absolute screen coordinates. - * - * @param instrumentation Instrumentation object used by the test. - * @param x Screen absolute x location. - * @param y Screen absolute y location. - */ - private static void mouseSingleClick(Instrumentation instrumentation, float x, float y) { - long downTime = SystemClock.uptimeMillis(); - sendMouseAction(instrumentation, MotionEvent.ACTION_DOWN, downTime, x, y); - sendMouseAction(instrumentation, MotionEvent.ACTION_UP, downTime, x, y); - } - - /** - * Sends (synchronously) a single mouse click to the View at the specified coordinates. - * - * @param instrumentation Instrumentation object used by the test. - * @param v The view the coordinates are relative to. - * @param x Relative x location to the view. - * @param y Relative y location to the view. - */ - public static void mouseSingleClickView(Instrumentation instrumentation, View v, int x, - int y) { - int location[] = TestTouchUtils.getAbsoluteLocationFromRelative(v, x, y); - int absoluteX = location[0]; - int absoluteY = location[1]; - mouseSingleClick(instrumentation, absoluteX, absoluteY); - } - - /** - * Sends (synchronously) a single mouse click to the center of the View. - * - * @param instrumentation Instrumentation object used by the test. - * @param v The view the coordinates are relative to. - */ - public static void mouseSingleClickView(Instrumentation instrumentation, View v) { - int x = v.getWidth() / 2; - int y = v.getHeight() / 2; - mouseSingleClickView(instrumentation, v, x, y); - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/remote/CastTestBase.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/remote/CastTestBase.java index ba919a6b..beaa0cec 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/remote/CastTestBase.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/remote/CastTestBase.java
@@ -21,6 +21,7 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.test.ChromeActivityTestCaseBase; import org.chromium.content.browser.ContentViewCore; +import org.chromium.content.browser.test.util.ClickUtils; import org.chromium.content.browser.test.util.DOMUtils; import org.chromium.content.browser.test.util.JavaScriptUtils; import org.chromium.content.browser.test.util.UiUtils; @@ -311,7 +312,7 @@ getActivity(), chromecastName, MAX_VIEW_TIME_MS, VIEW_RETRY_MS); assertNotNull("Test route not found", testRouteButton); - RouterTestUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); + ClickUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); } protected void checkDisconnected() { @@ -356,7 +357,7 @@ assertNotNull("No disconnect button", disconnectButton); - RouterTestUtils.clickButton(disconnectButton); + ClickUtils.clickButton(disconnectButton); } /* @@ -563,7 +564,7 @@ ((float) (rect.top + rect.bottom)) / 2) + core.getTopControlsHeightPix(); // Click using a virtual mouse, since a touch may result in a disambiguation pop-up. - RouterTestUtils.mouseSingleClickView(getInstrumentation(), tab.getView(), clickX, clickY); + ClickUtils.mouseSingleClickView(getInstrumentation(), tab.getView(), clickX, clickY); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java index 9818d25..124bae6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java
@@ -22,6 +22,7 @@ import org.chromium.chrome.browser.media.RouterTestUtils; import org.chromium.chrome.test.ChromeActivityTestCaseBase; import org.chromium.chrome.test.util.ChromeRestriction; +import org.chromium.content.browser.test.util.ClickUtils; import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.CriteriaHelper; import org.chromium.content.browser.test.util.JavaScriptUtils; @@ -213,7 +214,7 @@ executeJavaScriptApi(webContents, START_SESSION_SCRIPT); View testRouteButton = RouterTestUtils.waitForRouteButton( getActivity(), TEST_SINK_NAME, VIEW_TIMEOUT_MS, VIEW_RETRY_MS); - RouterTestUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); + ClickUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); executeJavaScriptApi(webContents, CHECK_SESSION_SCRIPT); String sessionId = getJavaScriptVariable(webContents, "startedConnection.id"); assertFalse(sessionId.length() == 0); @@ -233,7 +234,7 @@ executeJavaScriptApi(webContents, START_SESSION_SCRIPT); View testRouteButton = RouterTestUtils.waitForRouteButton( getActivity(), TEST_SINK_NAME, VIEW_TIMEOUT_MS, VIEW_RETRY_MS); - RouterTestUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); + ClickUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); executeJavaScriptApi(webContents, CHECK_SESSION_SCRIPT); String sessionId = getJavaScriptVariable(webContents, "startedConnection.id"); assertFalse(sessionId.length() == 0); @@ -253,7 +254,7 @@ executeJavaScriptApi(webContents, START_SESSION_SCRIPT); View testRouteButton = RouterTestUtils.waitForRouteButton( getActivity(), TEST_SINK_NAME, VIEW_TIMEOUT_MS, VIEW_RETRY_MS); - RouterTestUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); + ClickUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); executeJavaScriptApi(webContents, CHECK_SESSION_SCRIPT); String sessionId = getJavaScriptVariable(webContents, "startedConnection.id"); assertFalse(sessionId.length() == 0); @@ -273,7 +274,7 @@ executeJavaScriptApi(webContents, START_SESSION_SCRIPT); View testRouteButton = RouterTestUtils.waitForRouteButton( getActivity(), TEST_SINK_NAME, VIEW_TIMEOUT_MS, VIEW_RETRY_MS); - RouterTestUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); + ClickUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); checkStartFailed( webContents, "UnknownError", "No provider supports createRoute with source"); } @@ -289,7 +290,7 @@ executeJavaScriptApi(webContents, START_SESSION_SCRIPT); View testRouteButton = RouterTestUtils.waitForRouteButton( getActivity(), TEST_SINK_NAME, VIEW_TIMEOUT_MS, VIEW_RETRY_MS); - RouterTestUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); + ClickUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); checkStartFailed( webContents, "UnknownError", "Unknown sink"); } @@ -305,7 +306,7 @@ executeJavaScriptApi(webContents, START_SESSION_SCRIPT); View testRouteButton = RouterTestUtils.waitForRouteButton( getActivity(), TEST_SINK_NAME, VIEW_TIMEOUT_MS, VIEW_RETRY_MS); - RouterTestUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); + ClickUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); executeJavaScriptApi(webContents, CHECK_SESSION_SCRIPT); String sessionId = getJavaScriptVariable(webContents, "startedConnection.id"); @@ -330,7 +331,7 @@ executeJavaScriptApi(webContents, START_SESSION_SCRIPT); View testRouteButton = RouterTestUtils.waitForRouteButton( getActivity(), TEST_SINK_NAME, VIEW_TIMEOUT_MS, VIEW_RETRY_MS); - RouterTestUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); + ClickUtils.mouseSingleClickView(getInstrumentation(), testRouteButton); executeJavaScriptApi(webContents, CHECK_SESSION_SCRIPT); String sessionId = getJavaScriptVariable(webContents, "startedConnection.id");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java index 6f0890ec..a3c058a5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java
@@ -12,10 +12,8 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.UrlUtils; -// TODO(bsheedy): Factor out the code used from RouterTestUtils into a new -// file like org.chromium.base.test.util.ClickUtils or similar -import org.chromium.chrome.browser.media.RouterTestUtils; import org.chromium.chrome.test.ChromeTabbedActivityTestBase; +import org.chromium.content.browser.test.util.ClickUtils; import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.CriteriaHelper; import org.chromium.content.browser.test.util.JavaScriptUtils; @@ -98,7 +96,7 @@ * to fulfil WebVR's gesture requirement for presenting. */ private void enterVrTap() { - RouterTestUtils.mouseSingleClickView( + ClickUtils.mouseSingleClickView( getInstrumentation(), getActivity().getWindow().getDecorView().getRootView()); }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index dd970ea..ed4b4ac 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -1929,10 +1929,14 @@ <!-- Touch Bar--> <if expr="is_macosx"> - <message name="IDS_TOUCH_BAR_SEARCH" - desc="Text for the search button in the touch bar. Pressing the button will bring focus to the omnibox."> + <message name="IDS_TOUCH_BAR_GOOGLE_SEARCH" + desc="Text for the search button in the touch bar when Google is the default search provider. Pressing the button will bring focus to the omnibox."> Search or type URL </message> + <message name="IDS_TOUCH_BAR_SEARCH" + desc="Text for the search button in the touch bar when Google is not the default search provider. Pressing the button will bring focus to the omnibox."> + Search $1 + </message> </if> @@ -6991,6 +6995,12 @@ <message name="IDS_FLAGS_NEW_OMNIBOX_ANSWER_TYPES_DESCRIPTION" desc="Description of the flag to enable the new answers in suggest types in the omnibox."> Enables new types of answers in the omnibox suggest drop-down: currency conversions, dictionary definitions, sports scores, translations, and when is. </message> + <message name="IDS_FLAGS_ENABLE_ZERO_SUGGEST_REDIRECT_TO_CHROME_NAME" desc="Name of the flag option to enable the redirect of omnibox zero suggest requests to a backend maintained by Chrome."> + Experimental contextual omnibox suggestion + </message> + <message name="IDS_FLAGS_ENABLE_ZERO_SUGGEST_REDIRECT_TO_CHROME_DESCRIPTION" desc="Description of the flag option to enable the redirect of omnibox zero suggest requests to a backend maintained by Chrome."> + Change omnibox contextual suggestions to an experimental source. Note that this is not an on/off switch for contextual omnibox and it only applies to suggestions provided before the user starts typing a URL or a search query (i.e. zero suggest). + </message> <!--Tooltip strings--> <message name="IDS_TOOLTIP_BACK" desc="The tooltip for back button">
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 21c5460..9bf4d2f 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -4370,8 +4370,8 @@ "chromeos/input_method/mock_input_method_engine.h", "chromeos/input_method/mock_input_method_manager_impl.cc", "chromeos/input_method/mock_input_method_manager_impl.h", - "chromeos/login/screens/mock_device_disabled_screen_actor.cc", - "chromeos/login/screens/mock_device_disabled_screen_actor.h", + "chromeos/login/screens/mock_device_disabled_screen_view.cc", + "chromeos/login/screens/mock_device_disabled_screen_view.h", "chromeos/login/session/user_session_manager_test_api.cc", "chromeos/login/session/user_session_manager_test_api.h", "chromeos/login/test/js_checker.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index c50a88c..4096ba0 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -50,6 +50,7 @@ #include "components/ntp_snippets/ntp_snippets_constants.h" #include "components/ntp_tiles/switches.h" #include "components/offline_pages/core/offline_page_feature.h" +#include "components/omnibox/browser/features.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/omnibox/browser/omnibox_switches.h" #include "components/password_manager/core/common/password_manager_features.h" @@ -2286,6 +2287,10 @@ SINGLE_VALUE_TYPE(ash::switches::kAshAdjustableLargeCursor)}, #endif // OS_CHROMEOS + {"enable-zero-suggest-redirect-to-chrome", + IDS_FLAGS_ENABLE_ZERO_SUGGEST_REDIRECT_TO_CHROME_NAME, + IDS_FLAGS_ENABLE_ZERO_SUGGEST_REDIRECT_TO_CHROME_DESCRIPTION, kOsDesktop, + FEATURE_VALUE_TYPE(features::kZeroSuggestRedirectToChrome)}, {"new-omnibox-answer-types", IDS_FLAGS_NEW_OMNIBOX_ANSWER_TYPES_NAME, IDS_FLAGS_NEW_OMNIBOX_ANSWER_TYPES_DESCRIPTION, kOsAll, FEATURE_VALUE_TYPE(omnibox::kNewOmniboxAnswerTypes)},
diff --git a/chrome/browser/android/offline_pages/prerender_adapter.cc b/chrome/browser/android/offline_pages/prerender_adapter.cc index f780cfc..e959380 100644 --- a/chrome/browser/android/offline_pages/prerender_adapter.cc +++ b/chrome/browser/android/offline_pages/prerender_adapter.cc
@@ -102,4 +102,15 @@ } } +void PrerenderAdapter::OnPrerenderNetworkBytesChanged( + prerender::PrerenderHandle* handle) { + if (IsActive()) { + DCHECK_EQ(active_handle_.get(), handle); + prerender::PrerenderContents* contents = handle->contents(); + if (!contents) + return; + observer_->OnPrerenderNetworkBytesChanged(contents->network_bytes()); + } +} + } // namespace offline_pages
diff --git a/chrome/browser/android/offline_pages/prerender_adapter.h b/chrome/browser/android/offline_pages/prerender_adapter.h index ca378d7..23b9037 100644 --- a/chrome/browser/android/offline_pages/prerender_adapter.h +++ b/chrome/browser/android/offline_pages/prerender_adapter.h
@@ -40,6 +40,11 @@ // WebContents (via |GetWebContents()|) have become invalidated. virtual void OnPrerenderStop() = 0; + // Signals that a resource finished loading and altered the running byte + // count. |bytes| is the cumulative number of bytes received for this + // handle. + virtual void OnPrerenderNetworkBytesChanged(int64_t bytes) = 0; + protected: Observer(); virtual ~Observer(); @@ -83,6 +88,8 @@ void OnPrerenderStopLoading(prerender::PrerenderHandle* handle) override; void OnPrerenderDomContentLoaded(prerender::PrerenderHandle* handle) override; void OnPrerenderStop(prerender::PrerenderHandle* handle) override; + void OnPrerenderNetworkBytesChanged( + prerender::PrerenderHandle* handle) override; private: // At most one prerender request may be active for this adapter and this
diff --git a/chrome/browser/android/offline_pages/prerender_adapter_unittest.cc b/chrome/browser/android/offline_pages/prerender_adapter_unittest.cc index 2587ea30..dffa3e5 100644 --- a/chrome/browser/android/offline_pages/prerender_adapter_unittest.cc +++ b/chrome/browser/android/offline_pages/prerender_adapter_unittest.cc
@@ -113,6 +113,7 @@ void OnPrerenderStopLoading() override; void OnPrerenderDomContentLoaded() override; void OnPrerenderStop() override; + void OnPrerenderNetworkBytesChanged(int64_t bytes) override; void SetUp() override; @@ -130,6 +131,9 @@ return observer_dom_content_loaded_called_; } bool observer_stop_called() const { return observer_stop_called_; } + int64_t observer_network_bytes_changed() const { + return observer_network_bytes_changed_; + } private: content::TestBrowserThreadBundle thread_bundle_; @@ -140,6 +144,7 @@ bool observer_stop_loading_called_; bool observer_dom_content_loaded_called_; bool observer_stop_called_; + int64_t observer_network_bytes_changed_; DISALLOW_COPY_AND_ASSIGN(PrerenderAdapterTest); }; @@ -149,7 +154,8 @@ prerender_manager_(nullptr), observer_stop_loading_called_(false), observer_dom_content_loaded_called_(false), - observer_stop_called_(false) {} + observer_stop_called_(false), + observer_network_bytes_changed_(0) {} PrerenderAdapterTest::~PrerenderAdapterTest() { if (prerender_manager_) @@ -168,6 +174,10 @@ observer_stop_called_ = true; } +void PrerenderAdapterTest::OnPrerenderNetworkBytesChanged(int64_t bytes) { + observer_network_bytes_changed_ = bytes; +} + void PrerenderAdapterTest::SetUp() { if (base::SysInfo::IsLowEndDevice()) return; @@ -229,6 +239,11 @@ ->last_prerender_contents() ->ReportDomContentEvent(); EXPECT_TRUE(observer_dom_content_loaded_called()); + + // Expect byte count reported to Observer. + prerender_contents_factory()->last_prerender_contents()->AddNetworkBytes(153); + EXPECT_EQ(153LL, observer_network_bytes_changed()); + prerender_contents_factory()->last_prerender_contents()->ReportOnLoadEvent(); EXPECT_TRUE(observer_stop_loading_called()); prerender_contents_factory()->last_prerender_contents()->StopWithStatus(
diff --git a/chrome/browser/android/offline_pages/prerendering_loader.cc b/chrome/browser/android/offline_pages/prerendering_loader.cc index f6e1b6e..7b1ab65 100644 --- a/chrome/browser/android/offline_pages/prerendering_loader.cc +++ b/chrome/browser/android/offline_pages/prerendering_loader.cc
@@ -88,7 +88,8 @@ } bool PrerenderingLoader::LoadPage(const GURL& url, - const LoadPageCallback& callback) { + const LoadPageCallback& load_done_callback, + const ProgressCallback& progress_callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!IsIdle()) { DVLOG(1) @@ -115,7 +116,8 @@ new SnapshotController(base::ThreadTaskRunnerHandle::Get(), this, kOfflinePageDclDelayMs, kOfflinePageOnloadDelayMs)); - callback_ = callback; + load_done_callback_ = load_done_callback; + progress_callback_ = progress_callback; session_contents_.swap(new_web_contents); state_ = State::LOADING; return true; @@ -170,6 +172,11 @@ HandleLoadingStopped(); } +void PrerenderingLoader::OnPrerenderNetworkBytesChanged(int64_t bytes) { + if (state_ == State::LOADING) + progress_callback_.Run(bytes); +} + void PrerenderingLoader::StartSnapshot() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); HandleLoadEvent(); @@ -190,8 +197,8 @@ if (web_contents) { state_ = State::LOADED; base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::Bind(callback_, Offliner::RequestStatus::LOADED, web_contents)); + FROM_HERE, base::Bind(load_done_callback_, + Offliner::RequestStatus::LOADED, web_contents)); } else { // No WebContents means that the load failed (and it stopped). HandleLoadingStopped(); @@ -245,7 +252,7 @@ session_contents_.reset(nullptr); state_ = State::IDLE; base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(callback_, request_status, nullptr)); + FROM_HERE, base::Bind(load_done_callback_, request_status, nullptr)); } void PrerenderingLoader::CancelPrerender() {
diff --git a/chrome/browser/android/offline_pages/prerendering_loader.h b/chrome/browser/android/offline_pages/prerendering_loader.h index df54110..9ea9c84 100644 --- a/chrome/browser/android/offline_pages/prerendering_loader.h +++ b/chrome/browser/android/offline_pages/prerendering_loader.h
@@ -32,6 +32,8 @@ typedef base::Callback<void(Offliner::RequestStatus, content::WebContents*)> LoadPageCallback; + typedef base::Callback<void(int64_t)> ProgressCallback; + explicit PrerenderingLoader(content::BrowserContext* browser_context); ~PrerenderingLoader() override; @@ -43,7 +45,9 @@ // once - first for a successful load and then if canceled after the // load (which may be from resources being reclaimed) at which point // the retrieved WebContents should no longer be used. - virtual bool LoadPage(const GURL& url, const LoadPageCallback& callback); + virtual bool LoadPage(const GURL& url, + const LoadPageCallback& load_done_callback, + const ProgressCallback& progress_callback); // Stops (completes or cancels) the load request. Must be called when // LoadPageCallback is done with consuming the contents. May be called @@ -70,6 +74,7 @@ void OnPrerenderStopLoading() override; void OnPrerenderDomContentLoaded() override; void OnPrerenderStop() override; + void OnPrerenderNetworkBytesChanged(int64_t bytes) override; // SnapshotController::Client implementation: void StartSnapshot() override; @@ -114,7 +119,10 @@ // Callback to call when the active load request completes, fails, or is // canceled. - LoadPageCallback callback_; + LoadPageCallback load_done_callback_; + + // Callback to call when we know more bytes have loaded from the network. + ProgressCallback progress_callback_; DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader); };
diff --git a/chrome/browser/android/offline_pages/prerendering_loader_unittest.cc b/chrome/browser/android/offline_pages/prerendering_loader_unittest.cc index 929d78b1..3036d9d6 100644 --- a/chrome/browser/android/offline_pages/prerendering_loader_unittest.cc +++ b/chrome/browser/android/offline_pages/prerendering_loader_unittest.cc
@@ -168,7 +168,8 @@ EXPECT_FALSE(loader()->IsLoaded()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); test_adapter()->GetObserver()->OnPrerenderDomContentLoaded(); // Skip SnapshotController's wait time and emulate StartSnapshot call. @@ -193,7 +194,8 @@ EXPECT_FALSE(loader()->IsLoaded()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); PumpLoop(); EXPECT_FALSE(loader()->IsIdle()); @@ -224,7 +226,8 @@ EXPECT_TRUE(loader()->IsIdle()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_FALSE(loader()->IsIdle()); EXPECT_FALSE(loader()->IsLoaded()); @@ -247,7 +250,8 @@ EXPECT_TRUE(loader()->IsIdle()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_FALSE(loader()->IsIdle()); EXPECT_FALSE(loader()->IsLoaded()); @@ -272,7 +276,8 @@ EXPECT_TRUE(loader()->IsIdle()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_FALSE(loader()->IsIdle()); EXPECT_FALSE(loader()->IsLoaded()); @@ -297,7 +302,8 @@ EXPECT_TRUE(loader()->IsIdle()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_FALSE(loader()->IsIdle()); EXPECT_FALSE(loader()->IsLoaded()); @@ -319,7 +325,8 @@ EXPECT_TRUE(loader()->IsIdle()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_FALSE(loader()->IsIdle()); EXPECT_FALSE(loader()->IsLoaded()); @@ -341,7 +348,8 @@ EXPECT_TRUE(loader()->IsIdle()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_FALSE(loader()->IsIdle()); EXPECT_FALSE(loader()->IsLoaded()); @@ -356,14 +364,16 @@ EXPECT_TRUE(loader()->IsIdle()); EXPECT_TRUE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_FALSE(loader()->IsIdle()); EXPECT_FALSE(loader()->IsLoaded()); // Now try another load while first is still active. EXPECT_FALSE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_FALSE(loader()->IsIdle()); } @@ -373,7 +383,8 @@ EXPECT_TRUE(loader()->IsIdle()); EXPECT_FALSE(loader()->LoadPage( gurl, - base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)))); + base::Bind(&PrerenderingLoaderTest::OnLoadDone, base::Unretained(this)), + base::Bind([](int64_t bytes) {}))); EXPECT_TRUE(loader()->IsIdle()); }
diff --git a/chrome/browser/android/offline_pages/prerendering_offliner.cc b/chrome/browser/android/offline_pages/prerendering_offliner.cc index 31c0813..5ceaf65 100644 --- a/chrome/browser/android/offline_pages/prerendering_offliner.cc +++ b/chrome/browser/android/offline_pages/prerendering_offliner.cc
@@ -12,11 +12,15 @@ #include "chrome/browser/profiles/profile.h" #include "components/offline_pages/core/background/save_page_request.h" #include "components/offline_pages/core/client_namespace_constants.h" +#include "components/offline_pages/core/downloads/download_ui_adapter.h" #include "components/offline_pages/core/offline_page_model.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/web_contents.h" namespace offline_pages { +namespace { +const char kDownloadUIAdapterKey[] = "download-ui-adapter"; +} PrerenderingOffliner::PrerenderingOffliner( content::BrowserContext* browser_context, @@ -31,6 +35,20 @@ PrerenderingOffliner::~PrerenderingOffliner() {} +void PrerenderingOffliner::OnNetworkProgress(const SavePageRequest& request, + int64_t bytes) { + if (!pending_request_) + return; + + DownloadUIAdapter* ui_adapter = static_cast<DownloadUIAdapter*>( + offline_page_model_->GetUserData(kDownloadUIAdapterKey)); + + if (!ui_adapter) + return; + + ui_adapter->UpdateProgress(request.request_id(), bytes); +} + void PrerenderingOffliner::OnLoadPageDone( const SavePageRequest& request, Offliner::RequestStatus load_status, @@ -178,7 +196,9 @@ // Kick off load page attempt. bool accepted = GetOrCreateLoader()->LoadPage( request.url(), base::Bind(&PrerenderingOffliner::OnLoadPageDone, - weak_ptr_factory_.GetWeakPtr(), request)); + weak_ptr_factory_.GetWeakPtr(), request), + base::Bind(&PrerenderingOffliner::OnNetworkProgress, + weak_ptr_factory_.GetWeakPtr(), request)); if (!accepted) { pending_request_.reset(nullptr); } else {
diff --git a/chrome/browser/android/offline_pages/prerendering_offliner.h b/chrome/browser/android/offline_pages/prerendering_offliner.h index 45eca74..783dc9f 100644 --- a/chrome/browser/android/offline_pages/prerendering_offliner.h +++ b/chrome/browser/android/offline_pages/prerendering_offliner.h
@@ -57,6 +57,9 @@ const SavePageCallback& save_callback); private: + // Progress callback for PrerenderingLoader::LoadPage(). + void OnNetworkProgress(const SavePageRequest& request, int64_t bytes); + // Callback logic for PrerenderingLoader::LoadPage(). void OnLoadPageDone(const SavePageRequest& request, Offliner::RequestStatus load_status,
diff --git a/chrome/browser/android/offline_pages/prerendering_offliner_unittest.cc b/chrome/browser/android/offline_pages/prerendering_offliner_unittest.cc index b9a3f70c..4177ff38 100644 --- a/chrome/browser/android/offline_pages/prerendering_offliner_unittest.cc +++ b/chrome/browser/android/offline_pages/prerendering_offliner_unittest.cc
@@ -42,9 +42,12 @@ mock_loaded_(false) {} ~MockPrerenderingLoader() override {} - bool LoadPage(const GURL& url, const LoadPageCallback& callback) override { + bool LoadPage(const GURL& url, + const LoadPageCallback& load_done_callback, + const ProgressCallback& progress_callback) override { mock_loading_ = can_prerender_; - load_page_callback_ = callback; + load_page_callback_ = load_done_callback; + progress_callback_ = progress_callback; return mock_loading_; } @@ -95,6 +98,7 @@ bool mock_loading_; bool mock_loaded_; LoadPageCallback load_page_callback_; + ProgressCallback progress_callback_; DISALLOW_COPY_AND_ASSIGN(MockPrerenderingLoader); };
diff --git a/chrome/browser/android/offline_pages/recent_tab_helper.cc b/chrome/browser/android/offline_pages/recent_tab_helper.cc index a2019a31..064036a 100644 --- a/chrome/browser/android/offline_pages/recent_tab_helper.cc +++ b/chrome/browser/android/offline_pages/recent_tab_helper.cc
@@ -117,6 +117,8 @@ // If this tab helper is not enabled, immediately give the job back to // RequestCoordinator. if (!EnsureInitialized()) { + DVLOG(1) << "Snapshots disabled; ignored download request for: " + << web_contents()->GetLastCommittedURL().spec(); ReportDownloadStatusToRequestCoordinator(new_downloads_snapshot_info.get(), false); return; @@ -132,6 +134,8 @@ // request to download the page will be immediately dismissed. See // https://crbug.com/686283. if (downloads_ongoing_snapshot_info_) { + DVLOG(1) << "Ongoing request exist; ignored download request for: " + << web_contents()->GetLastCommittedURL().spec(); ReportDownloadStatusToRequestCoordinator(new_downloads_snapshot_info.get(), true); return; @@ -143,11 +147,15 @@ // If the page is not yet ready for a snapshot return now as it will be // started later, once page loading advances. if (PageQuality::POOR == snapshot_controller_->current_page_quality()) { + DVLOG(1) << "Waiting for loading page to serve download request for: " + << web_contents()->GetLastCommittedURL().spec(); downloads_snapshot_on_hold_ = true; return; } // Otherwise start saving the snapshot now. + DVLOG(1) << "Starting download request for: " + << web_contents()->GetLastCommittedURL().spec(); SaveSnapshotForDownloads(false); } @@ -185,15 +193,23 @@ content::NavigationHandle* navigation_handle) { if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted() || navigation_handle->IsSamePage()) { + DVLOG_IF(1, navigation_handle->IsInMainFrame()) + << "Main frame navigation ignored (reasons: " + << !navigation_handle->HasCommitted() << ", " + << navigation_handle->IsSamePage() + << ") to: " << web_contents()->GetLastCommittedURL().spec(); return; } if (!EnsureInitialized()) return; + DVLOG(1) << "Navigation acknowledged to: " + << web_contents()->GetLastCommittedURL().spec(); - // If there is an ongoing downloads request, lets allow Background Offliner to - // continue downloading this page. + // If there is an ongoing downloads request, lets make Background Offliner + // take over downloading that page. if (downloads_ongoing_snapshot_info_) { + DVLOG(1) << " - Passing ongoing downloads request to Background Offliner"; ReportDownloadStatusToRequestCoordinator( downloads_ongoing_snapshot_info_.get(), false); } @@ -211,6 +227,7 @@ OfflinePageModel::CanSaveURL(web_contents()->GetLastCommittedURL()) && OfflinePageUtils::GetOfflinePageFromWebContents(web_contents()) == nullptr; + DVLOG_IF(1, !can_save) << " - Page can not be saved"; UMA_HISTOGRAM_BOOLEAN("OfflinePages.CanSaveRecentPage", can_save); @@ -218,6 +235,7 @@ snapshot_controller_->Stop(); last_n_listen_to_tab_hidden_ = can_save && !delegate_->IsLowEndDevice() && IsOffliningRecentPagesEnabled(); + DVLOG_IF(1, !last_n_listen_to_tab_hidden_) << " - Last_n is disabled"; } void RecentTabHelper::DocumentAvailableInMainFrame() { @@ -233,9 +251,12 @@ void RecentTabHelper::WebContentsDestroyed() { // If there is an ongoing downloads request, lets allow Background Offliner to // continue downloading this page. - if (downloads_ongoing_snapshot_info_) + if (downloads_ongoing_snapshot_info_) { + DVLOG(1) << "WebContents destroyed; passing ongoing downloads request to " + "Background Offliner"; ReportDownloadStatusToRequestCoordinator( downloads_ongoing_snapshot_info_.get(), false); + } // And cancel any ongoing snapshots. CancelInFlightSnapshots(); } @@ -247,16 +268,26 @@ if (!IsOffliningRecentPagesEnabled()) return; - // Return immediately if last_n is not listening to tab hidden events or if a - // last_n snapshot is currently being saved. - if (!last_n_listen_to_tab_hidden_ || last_n_ongoing_snapshot_info_) + // Return immediately if last_n is not listening to tab hidden events, if a + // last_n snapshot is currently being saved or if the tab is closing. + if (!last_n_listen_to_tab_hidden_ || last_n_ongoing_snapshot_info_) { + DVLOG(1) << "Will not snapshot for last_n (reasons: " + << !last_n_listen_to_tab_hidden_ << ", " + << !!last_n_ongoing_snapshot_info_ + << ") for: " << web_contents()->GetLastCommittedURL().spec(); return; + } // Do not save if page quality is too low. // Note: we assume page quality for a page can only increase. - if (snapshot_controller_->current_page_quality() == PageQuality::POOR) + if (snapshot_controller_->current_page_quality() == PageQuality::POOR) { + DVLOG(1) << "Will not snapshot for last_n (page quality too low) for: " + << web_contents()->GetLastCommittedURL().spec(); return; + } + DVLOG(1) << "Starting last_n snapshot for: " + << web_contents()->GetLastCommittedURL().spec(); last_n_ongoing_snapshot_info_ = base::MakeUnique<SnapshotProgressInfo>(GetRecentPagesClientId()); DCHECK(last_n_ongoing_snapshot_info_->IsForLastN()); @@ -278,6 +309,8 @@ // that allow for a navigation event to start a snapshot: // 1) There is a request on hold waiting for the page to be minimally loaded. if (snapshots_enabled_ && downloads_snapshot_on_hold_) { + DVLOG(1) << "Resuming downloads snapshot request for: " + << web_contents()->GetLastCommittedURL().spec(); downloads_snapshot_on_hold_ = false; SaveSnapshotForDownloads(false); return; @@ -290,6 +323,8 @@ downloads_latest_saved_snapshot_info_ && downloads_latest_saved_snapshot_info_->expected_page_quality < snapshot_controller_->current_page_quality())) { + DVLOG(1) << "Upgrading last downloads snapshot for: " + << web_contents()->GetLastCommittedURL().spec(); SaveSnapshotForDownloads(true); return; } @@ -334,6 +369,8 @@ const std::vector<int64_t>& page_ids) { DCHECK(snapshot_info); + DVLOG_IF(1, !page_ids.empty()) << "Deleting " << page_ids.size() + << " offline pages..."; page_model_->DeletePagesByOfflineId( page_ids, base::Bind(&RecentTabHelper::ContinueSnapshotAfterPurge, weak_ptr_factory_.GetWeakPtr(), snapshot_info)); @@ -374,6 +411,9 @@ void RecentTabHelper::ReportSnapshotCompleted( SnapshotProgressInfo* snapshot_info, bool success) { + DVLOG(1) << (snapshot_info->IsForLastN() ? "Last_n" : "Downloads") + << " snapshot " << (success ? "succeeded" : "failed") + << " for: " << web_contents()->GetLastCommittedURL().spec(); if (snapshot_info->IsForLastN()) { DCHECK_EQ(snapshot_info, last_n_ongoing_snapshot_info_.get()); last_n_ongoing_snapshot_info_.reset();
diff --git a/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc b/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc index 2df851d..c9626478 100644 --- a/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc +++ b/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc
@@ -23,6 +23,7 @@ #include "components/offline_pages/core/offline_page_test_archiver.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_handle.h" +#include "content/public/browser/reload_type.h" #include "content/public/browser/web_contents.h" #include "content/public/common/referrer.h" #include "content/public/test/web_contents_tester.h" @@ -855,4 +856,35 @@ EXPECT_EQ(offline_id, downloads_page->offline_id); } +// Tests that a page reloaded is tracked as an actual load and properly saved. +TEST_F(RecentTabHelperTest, ReloadIsTrackedAsNavigationAndSavedOnlyUponLoad) { + // Navigates and load fully then hide the tab so that a snapshot is created. + NavigateAndCommit(kTestPageUrl); + recent_tab_helper()->DocumentOnLoadCompletedInMainFrame(); + FastForwardSnapshotController(); + recent_tab_helper()->WasHidden(); + RunUntilIdle(); + ASSERT_EQ(1U, GetAllPages().size()); + + // Starts a reload and hides the tab. No new snapshot should be saved. + controller().Reload(content::ReloadType::NORMAL, false); + content::WebContentsTester* web_contents_tester = + content::WebContentsTester::For(web_contents()); + web_contents_tester->CommitPendingNavigation(); + recent_tab_helper()->WasHidden(); + RunUntilIdle(); + EXPECT_EQ(1U, page_added_count()); + EXPECT_EQ(0U, model_removed_count()); + ASSERT_EQ(1U, GetAllPages().size()); + + // Finish loading and hide the tab. A new snapshot should be created. + recent_tab_helper()->DocumentOnLoadCompletedInMainFrame(); + FastForwardSnapshotController(); + recent_tab_helper()->WasHidden(); + RunUntilIdle(); + EXPECT_EQ(2U, page_added_count()); + EXPECT_EQ(1U, model_removed_count()); + ASSERT_EQ(1U, GetAllPages().size()); +} + } // namespace offline_pages
diff --git a/chrome/browser/android/vr_shell/ui_elements.cc b/chrome/browser/android/vr_shell/ui_elements.cc index bec47f4..5fb4805 100644 --- a/chrome/browser/android/vr_shell/ui_elements.cc +++ b/chrome/browser/android/vr_shell/ui_elements.cc
@@ -198,7 +198,7 @@ } bool ContentRectangle::IsHitTestable() const { - return hit_testable; + return IsVisible() && hit_testable; } } // namespace vr_shell
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 7486bd47..e6a5354 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -724,12 +724,12 @@ "login/easy_unlock/short_lived_user_context.h", "login/enrollment/auto_enrollment_check_screen.cc", "login/enrollment/auto_enrollment_check_screen.h", - "login/enrollment/auto_enrollment_check_screen_actor.h", + "login/enrollment/auto_enrollment_check_screen_view.h", "login/enrollment/auto_enrollment_controller.cc", "login/enrollment/auto_enrollment_controller.h", "login/enrollment/enrollment_screen.cc", "login/enrollment/enrollment_screen.h", - "login/enrollment/enrollment_screen_actor.h", + "login/enrollment/enrollment_screen_view.h", "login/enrollment/enrollment_uma.cc", "login/enrollment/enrollment_uma.h", "login/enrollment/enterprise_enrollment_helper.cc", @@ -778,8 +778,8 @@ "login/screen_manager.h", "login/screens/arc_terms_of_service_screen.cc", "login/screens/arc_terms_of_service_screen.h", - "login/screens/arc_terms_of_service_screen_actor.h", - "login/screens/arc_terms_of_service_screen_actor_observer.h", + "login/screens/arc_terms_of_service_screen_view.h", + "login/screens/arc_terms_of_service_screen_view_observer.h", "login/screens/base_screen.cc", "login/screens/base_screen.h", "login/screens/base_screen_delegate.h", @@ -787,18 +787,18 @@ "login/screens/chrome_user_selection_screen.h", "login/screens/controller_pairing_screen.cc", "login/screens/controller_pairing_screen.h", - "login/screens/controller_pairing_screen_actor.cc", - "login/screens/controller_pairing_screen_actor.h", - "login/screens/core_oobe_actor.h", + "login/screens/controller_pairing_screen_view.cc", + "login/screens/controller_pairing_screen_view.h", + "login/screens/core_oobe_view.h", "login/screens/device_disabled_screen.cc", "login/screens/device_disabled_screen.h", - "login/screens/device_disabled_screen_actor.h", + "login/screens/device_disabled_screen_view.h", "login/screens/enable_debugging_screen.cc", "login/screens/enable_debugging_screen.h", - "login/screens/enable_debugging_screen_actor.h", + "login/screens/enable_debugging_screen_view.h", "login/screens/error_screen.cc", "login/screens/error_screen.h", - "login/screens/error_screen_actor_delegate.h", + "login/screens/error_screen_view_delegate.h", "login/screens/eula_screen.cc", "login/screens/eula_screen.h", "login/screens/eula_view.h", @@ -809,14 +809,14 @@ "login/screens/hid_detection_view.h", "login/screens/host_pairing_screen.cc", "login/screens/host_pairing_screen.h", - "login/screens/host_pairing_screen_actor.cc", - "login/screens/host_pairing_screen_actor.h", + "login/screens/host_pairing_screen_view.cc", + "login/screens/host_pairing_screen_view.h", "login/screens/kiosk_autolaunch_screen.cc", "login/screens/kiosk_autolaunch_screen.h", - "login/screens/kiosk_autolaunch_screen_actor.h", + "login/screens/kiosk_autolaunch_screen_view.h", "login/screens/kiosk_enable_screen.cc", "login/screens/kiosk_enable_screen.h", - "login/screens/kiosk_enable_screen_actor.h", + "login/screens/kiosk_enable_screen_view.h", "login/screens/model_view_channel.h", "login/screens/network_error.cc", "login/screens/network_error.h", @@ -830,7 +830,7 @@ "login/screens/screen_flow.h", "login/screens/terms_of_service_screen.cc", "login/screens/terms_of_service_screen.h", - "login/screens/terms_of_service_screen_actor.h", + "login/screens/terms_of_service_screen_view.h", "login/screens/update_screen.cc", "login/screens/update_screen.h", "login/screens/update_view.h", @@ -840,7 +840,7 @@ "login/screens/user_selection_screen.h", "login/screens/wrong_hwid_screen.cc", "login/screens/wrong_hwid_screen.h", - "login/screens/wrong_hwid_screen_actor.h", + "login/screens/wrong_hwid_screen_view.h", "login/session/chrome_session_manager.cc", "login/session/chrome_session_manager.h", "login/session/user_session_manager.cc",
diff --git a/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc b/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc index 62a8c49..cfae8a4 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc +++ b/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc
@@ -23,8 +23,8 @@ #include "chrome/browser/chromeos/arc/arc_util.h" #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.h" #include "chrome/browser/chromeos/arc/test/arc_data_removed_waiter.h" -#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor.h" -#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor_observer.h" +#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view.h" +#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view_observer.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" @@ -674,7 +674,7 @@ class ArcSessionOobeOptInNegotiatorTest : public ArcSessionOobeOptInTest, - public chromeos::ArcTermsOfServiceScreenActor, + public chromeos::ArcTermsOfServiceScreenView, public testing::WithParamInterface<bool> { public: ArcSessionOobeOptInNegotiatorTest() = default; @@ -684,7 +684,7 @@ AppendEnableArcOOBEOptInSwitch(); - ArcTermsOfServiceOobeNegotiator::SetArcTermsOfServiceScreenActorForTesting( + ArcTermsOfServiceOobeNegotiator::SetArcTermsOfServiceScreenViewForTesting( this); GetFakeUserManager()->set_current_user_new(true); @@ -708,7 +708,7 @@ // Correctly stop service. arc_session_manager()->Shutdown(); - ArcTermsOfServiceOobeNegotiator::SetArcTermsOfServiceScreenActorForTesting( + ArcTermsOfServiceOobeNegotiator::SetArcTermsOfServiceScreenViewForTesting( nullptr); ArcSessionOobeOptInTest::TearDown(); @@ -727,9 +727,9 @@ base::RunLoop().RunUntilIdle(); } - void ReportActorDestroyed() { + void ReportViewDestroyed() { for (auto& observer : observer_list_) - observer.OnActorDestroyed(this); + observer.OnViewDestroyed(this); base::RunLoop().RunUntilIdle(); } @@ -745,17 +745,17 @@ ArcDataRemovedWaiter().Wait(); } - chromeos::ArcTermsOfServiceScreenActor* actor() { return this; } + chromeos::ArcTermsOfServiceScreenView* view() { return this; } private: - // ArcTermsOfServiceScreenActor: + // ArcTermsOfServiceScreenView: void AddObserver( - chromeos::ArcTermsOfServiceScreenActorObserver* observer) override { + chromeos::ArcTermsOfServiceScreenViewObserver* observer) override { observer_list_.AddObserver(observer); } void RemoveObserver( - chromeos::ArcTermsOfServiceScreenActorObserver* observer) override { + chromeos::ArcTermsOfServiceScreenViewObserver* observer) override { observer_list_.RemoveObserver(observer); } @@ -767,7 +767,7 @@ void Hide() override {} - base::ObserverList<chromeos::ArcTermsOfServiceScreenActorObserver> + base::ObserverList<chromeos::ArcTermsOfServiceScreenViewObserver> observer_list_; DISALLOW_COPY_AND_ASSIGN(ArcSessionOobeOptInNegotiatorTest); @@ -778,7 +778,7 @@ ::testing::Values(true, false)); TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsAccepted) { - actor()->Show(); + view()->Show(); MaybeWaitForDataRemoved(); EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, arc_session_manager()->state()); @@ -788,7 +788,7 @@ } TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsRejected) { - actor()->Show(); + view()->Show(); MaybeWaitForDataRemoved(); EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, arc_session_manager()->state()); @@ -798,13 +798,13 @@ EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile())); } -TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsActorDestroyed) { - actor()->Show(); +TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsViewDestroyed) { + view()->Show(); MaybeWaitForDataRemoved(); EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, arc_session_manager()->state()); CloseLoginDisplayHost(); - ReportActorDestroyed(); + ReportViewDestroyed(); EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state()); if (!IsManagedUser()) EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile()));
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.cc b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.cc index 2e55d95..1588bd3 100644 --- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.cc +++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.cc
@@ -5,7 +5,7 @@ #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.h" #include "base/bind.h" -#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" @@ -13,44 +13,44 @@ namespace { -chromeos::ArcTermsOfServiceScreenActor* g_actor_for_testing = nullptr; +chromeos::ArcTermsOfServiceScreenView* g_view_for_testing = nullptr; -chromeos::ArcTermsOfServiceScreenActor* GetScreenActor() { +chromeos::ArcTermsOfServiceScreenView* GetScreenView() { // Inject testing instance. - if (g_actor_for_testing) - return g_actor_for_testing; + if (g_view_for_testing) + return g_view_for_testing; chromeos::LoginDisplayHost* host = chromeos::LoginDisplayHost::default_host(); DCHECK(host); DCHECK(host->GetOobeUI()); - return host->GetOobeUI()->GetArcTermsOfServiceScreenActor(); + return host->GetOobeUI()->GetArcTermsOfServiceScreenView(); } } // namespace // static -void ArcTermsOfServiceOobeNegotiator::SetArcTermsOfServiceScreenActorForTesting( - chromeos::ArcTermsOfServiceScreenActor* actor) { - g_actor_for_testing = actor; +void ArcTermsOfServiceOobeNegotiator::SetArcTermsOfServiceScreenViewForTesting( + chromeos::ArcTermsOfServiceScreenView* view) { + g_view_for_testing = view; } ArcTermsOfServiceOobeNegotiator::ArcTermsOfServiceOobeNegotiator() = default; ArcTermsOfServiceOobeNegotiator::~ArcTermsOfServiceOobeNegotiator() { - DCHECK(!screen_actor_); + DCHECK(!screen_view_); } void ArcTermsOfServiceOobeNegotiator::StartNegotiationImpl() { - DCHECK(!screen_actor_); - screen_actor_ = GetScreenActor(); - DCHECK(screen_actor_); - screen_actor_->AddObserver(this); + DCHECK(!screen_view_); + screen_view_ = GetScreenView(); + DCHECK(screen_view_); + screen_view_->AddObserver(this); } void ArcTermsOfServiceOobeNegotiator::HandleTermsAccepted(bool accepted) { - DCHECK(screen_actor_); - screen_actor_->RemoveObserver(this); - screen_actor_ = nullptr; + DCHECK(screen_view_); + screen_view_->RemoveObserver(this); + screen_view_ = nullptr; ReportResult(accepted); } @@ -62,9 +62,9 @@ HandleTermsAccepted(true); } -void ArcTermsOfServiceOobeNegotiator::OnActorDestroyed( - chromeos::ArcTermsOfServiceScreenActor* actor) { - DCHECK_EQ(actor, screen_actor_); +void ArcTermsOfServiceOobeNegotiator::OnViewDestroyed( + chromeos::ArcTermsOfServiceScreenView* view) { + DCHECK_EQ(view, screen_view_); HandleTermsAccepted(false); }
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.h b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.h index df6f470..59af5dc6 100644 --- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.h +++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.h
@@ -7,10 +7,10 @@ #include "base/macros.h" #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h" -#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor_observer.h" +#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view_observer.h" namespace chromeos { -class ArcTermsOfServiceScreenActor; +class ArcTermsOfServiceScreenView; } namespace arc { @@ -18,39 +18,39 @@ // Handles the Terms-of-service agreement user action via OOBE OptIn UI. class ArcTermsOfServiceOobeNegotiator : public ArcTermsOfServiceNegotiator, - public chromeos::ArcTermsOfServiceScreenActorObserver { + public chromeos::ArcTermsOfServiceScreenViewObserver { public: ArcTermsOfServiceOobeNegotiator(); ~ArcTermsOfServiceOobeNegotiator() override; // Injects ARC OOBE screen handler in unit tests, where OOBE UI is not // available. - static void SetArcTermsOfServiceScreenActorForTesting( - chromeos::ArcTermsOfServiceScreenActor* actor); + static void SetArcTermsOfServiceScreenViewForTesting( + chromeos::ArcTermsOfServiceScreenView* view); private: // Helper to handle callbacks from - // chromeos::ArcTermsOfServiceScreenActorObserver. It removes observer from - // |screen_actor_|, resets it, and then dispatches |accepted|. It is expected + // chromeos::ArcTermsOfServiceScreenViewObserver. It removes observer from + // |screen_view_|, resets it, and then dispatches |accepted|. It is expected // that this method is called exactly once for each instance of // ArcTermsOfServiceOobeNegotiator. void HandleTermsAccepted(bool accepted); - // chromeos::ArcTermsOfServiceScreenActorObserver: + // chromeos::ArcTermsOfServiceScreenViewObserver: void OnSkip() override; void OnAccept() override; - void OnActorDestroyed(chromeos::ArcTermsOfServiceScreenActor* actor) override; + void OnViewDestroyed(chromeos::ArcTermsOfServiceScreenView* view) override; // ArcTermsOfServiceNegotiator: void StartNegotiationImpl() override; // Unowned pointer. If a user signs out while ARC OOBE opt-in is active, - // LoginDisplayHost is detached first then OnActorDestroyed is called. - // It means, in OnSkip() and OnAccept(), the Actor needs to be obtained via - // LoginDisplayHost, but in OnActorDestroyed(), the argument needs to be used. - // In order to use the same way to access the Actor, remember the pointer in + // LoginDisplayHost is detached first then OnViewDestroyed is called. + // It means, in OnSkip() and OnAccept(), the View needs to be obtained via + // LoginDisplayHost, but in OnViewDestroyed(), the argument needs to be used. + // In order to use the same way to access the View, remember the pointer in // StartNegotiationImpl(), and reset in HandleTermsAccepted(). - chromeos::ArcTermsOfServiceScreenActor* screen_actor_ = nullptr; + chromeos::ArcTermsOfServiceScreenView* screen_view_ = nullptr; DISALLOW_COPY_AND_ASSIGN(ArcTermsOfServiceOobeNegotiator); };
diff --git a/chrome/browser/chromeos/events/event_rewriter.cc b/chrome/browser/chromeos/events/event_rewriter.cc index d532a8b..5a68721 100644 --- a/chrome/browser/chromeos/events/event_rewriter.cc +++ b/chrome/browser/chromeos/events/event_rewriter.cc
@@ -20,6 +20,8 @@ #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/extensions/extension_commands_global_registry.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" +#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "chrome/common/pref_names.h" #include "chromeos/chromeos_switches.h" #include "components/prefs/pref_service.h" @@ -132,14 +134,24 @@ // prefs::kLanguageRemapSearchKeyTo. const ModifierRemapping* GetRemappedKey(const std::string& pref_name, const PrefService& pref_service) { - if (!pref_service.FindPreference(pref_name.c_str())) - return NULL; // The |pref_name| hasn't been registered. On login screen? - const int value = pref_service.GetInteger(pref_name.c_str()); + int value = -1; + // If we're at the login screen, try to get the pref from the global prefs + // dictionary. + if (!LoginDisplayHost::default_host() || + !LoginDisplayHost::default_host() + ->GetOobeUI() + ->signin_screen_handler() + ->GetKeyboardRemappedPrefValue(pref_name, &value)) { + if (!pref_service.FindPreference(pref_name)) + return nullptr; + value = pref_service.GetInteger(pref_name); + } + for (size_t i = 0; i < arraysize(kModifierRemappings); ++i) { if (value == kModifierRemappings[i].remap_to) return &kModifierRemappings[i]; } - return NULL; + return nullptr; } bool HasDiamondKey() {
diff --git a/chrome/browser/chromeos/login/app_launch_controller.cc b/chrome/browser/chromeos/login/app_launch_controller.cc index 9de81cdb..779c7da 100644 --- a/chrome/browser/chromeos/login/app_launch_controller.cc +++ b/chrome/browser/chromeos/login/app_launch_controller.cc
@@ -150,11 +150,11 @@ diagnostic_mode_(diagnostic_mode), host_(host), oobe_ui_(oobe_ui), - app_launch_splash_screen_actor_( - oobe_ui_->GetAppLaunchSplashScreenActor()) {} + app_launch_splash_screen_view_(oobe_ui_->GetAppLaunchSplashScreenView()) { +} AppLaunchController::~AppLaunchController() { - app_launch_splash_screen_actor_->SetDelegate(NULL); + app_launch_splash_screen_view_->SetDelegate(NULL); } void AppLaunchController::StartAppLaunch(bool is_auto_launch) { @@ -173,8 +173,8 @@ launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); // TODO(tengs): Add a loading profile app launch state. - app_launch_splash_screen_actor_->SetDelegate(this); - app_launch_splash_screen_actor_->Show(app_id_); + app_launch_splash_screen_view_->SetDelegate(this); + app_launch_splash_screen_view_->Show(app_id_); KioskAppManager::App app; CHECK(KioskAppManager::Get()); @@ -280,8 +280,8 @@ if (requested) { MaybeShowNetworkConfigureUI(); } else { - app_launch_splash_screen_actor_->UpdateAppLaunchState( - AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK); + app_launch_splash_screen_view_->UpdateAppLaunchState( + AppLaunchSplashScreenView::APP_LAUNCH_STATE_PREPARING_NETWORK); startup_app_launcher_->RestartLauncher(); } } @@ -381,28 +381,28 @@ if (network_config_requested_) OnConfigureNetwork(); else - app_launch_splash_screen_actor_->ToggleNetworkConfig(true); + app_launch_splash_screen_view_->ToggleNetworkConfig(true); } else { ShowNetworkConfigureUIWhenReady(); } } else { - app_launch_splash_screen_actor_->UpdateAppLaunchState( - AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT); + app_launch_splash_screen_view_->UpdateAppLaunchState( + AppLaunchSplashScreenView::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT); } } void AppLaunchController::ShowNetworkConfigureUIWhenReady() { if (!profile_) { show_network_config_ui_after_profile_load_ = true; - app_launch_splash_screen_actor_->UpdateAppLaunchState( - AppLaunchSplashScreenActor:: + app_launch_splash_screen_view_->UpdateAppLaunchState( + AppLaunchSplashScreenView:: APP_LAUNCH_STATE_SHOWING_NETWORK_CONFIGURE_UI); return; } show_network_config_ui_after_profile_load_ = false; showing_network_dialog_ = true; - app_launch_splash_screen_actor_->ShowNetworkConfigureUI(); + app_launch_splash_screen_view_->ShowNetworkConfigureUI(); } void AppLaunchController::InitializeNetwork() { @@ -414,12 +414,12 @@ base::TimeDelta::FromSeconds(network_wait_time_), this, &AppLaunchController::OnNetworkWaitTimedout); - app_launch_splash_screen_actor_->UpdateAppLaunchState( - AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK); + app_launch_splash_screen_view_->UpdateAppLaunchState( + AppLaunchSplashScreenView::APP_LAUNCH_STATE_PREPARING_NETWORK); } bool AppLaunchController::IsNetworkReady() { - return app_launch_splash_screen_actor_->IsNetworkReady(); + return app_launch_splash_screen_view_->IsNetworkReady(); } bool AppLaunchController::ShouldSkipAppInstallation() { @@ -427,26 +427,26 @@ } void AppLaunchController::OnLoadingOAuthFile() { - app_launch_splash_screen_actor_->UpdateAppLaunchState( - AppLaunchSplashScreenActor::APP_LAUNCH_STATE_LOADING_AUTH_FILE); + app_launch_splash_screen_view_->UpdateAppLaunchState( + AppLaunchSplashScreenView::APP_LAUNCH_STATE_LOADING_AUTH_FILE); } void AppLaunchController::OnInitializingTokenService() { - app_launch_splash_screen_actor_->UpdateAppLaunchState( - AppLaunchSplashScreenActor::APP_LAUNCH_STATE_LOADING_TOKEN_SERVICE); + app_launch_splash_screen_view_->UpdateAppLaunchState( + AppLaunchSplashScreenView::APP_LAUNCH_STATE_LOADING_TOKEN_SERVICE); } void AppLaunchController::OnInstallingApp() { - app_launch_splash_screen_actor_->UpdateAppLaunchState( - AppLaunchSplashScreenActor::APP_LAUNCH_STATE_INSTALLING_APPLICATION); + app_launch_splash_screen_view_->UpdateAppLaunchState( + AppLaunchSplashScreenView::APP_LAUNCH_STATE_INSTALLING_APPLICATION); ClearNetworkWaitTimer(); - app_launch_splash_screen_actor_->ToggleNetworkConfig(false); + app_launch_splash_screen_view_->ToggleNetworkConfig(false); // We have connectivity at this point, so we can skip the network // configuration dialog if it is being shown. if (showing_network_dialog_) { - app_launch_splash_screen_actor_->Show(app_id_); + app_launch_splash_screen_view_->Show(app_id_); showing_network_dialog_ = false; launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); } @@ -488,8 +488,8 @@ void AppLaunchController::OnLaunchSucceeded() { DVLOG(1) << "Kiosk launch succeeded, wait for app window."; - app_launch_splash_screen_actor_->UpdateAppLaunchState( - AppLaunchSplashScreenActor::APP_LAUNCH_STATE_WAITING_APP_WINDOW); + app_launch_splash_screen_view_->UpdateAppLaunchState( + AppLaunchSplashScreenView::APP_LAUNCH_STATE_WAITING_APP_WINDOW); DCHECK(!app_window_watcher_); app_window_watcher_.reset(new AppWindowWatcher(this, app_id_));
diff --git a/chrome/browser/chromeos/login/app_launch_controller.h b/chrome/browser/chromeos/login/app_launch_controller.h index c0399a7..be4b1893 100644 --- a/chrome/browser/chromeos/login/app_launch_controller.h +++ b/chrome/browser/chromeos/login/app_launch_controller.h
@@ -16,7 +16,7 @@ #include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h" #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" #include "chrome/browser/chromeos/login/app_launch_signin_screen.h" -#include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_view.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -30,12 +30,11 @@ // Controller for the kiosk app launch process, responsible for // coordinating loading the kiosk profile, launching the app, and // updating the splash screen UI. -class AppLaunchController - : public AppLaunchSplashScreenActor::Delegate, - public KioskProfileLoader::Delegate, - public StartupAppLauncher::Delegate, - public AppLaunchSigninScreen::Delegate, - public content::NotificationObserver { +class AppLaunchController : public AppLaunchSplashScreenView::Delegate, + public KioskProfileLoader::Delegate, + public StartupAppLauncher::Delegate, + public AppLaunchSigninScreen::Delegate, + public content::NotificationObserver { public: typedef base::Callback<bool()> ReturnBoolCallback; @@ -92,7 +91,7 @@ void OnProfileLoaded(Profile* profile) override; void OnProfileLoadFailed(KioskAppLaunchError::Error error) override; - // AppLaunchSplashScreenActor::Delegate overrides: + // AppLaunchSplashScreenView::Delegate overrides: void OnConfigureNetwork() override; void OnCancelAppLaunch() override; void OnNetworkConfigRequested(bool requested) override; @@ -123,7 +122,7 @@ const bool diagnostic_mode_; LoginDisplayHost* host_ = nullptr; OobeUI* oobe_ui_ = nullptr; - AppLaunchSplashScreenActor* app_launch_splash_screen_actor_ = nullptr; + AppLaunchSplashScreenView* app_launch_splash_screen_view_ = nullptr; std::unique_ptr<KioskProfileLoader> kiosk_profile_loader_; std::unique_ptr<StartupAppLauncher> startup_app_launcher_; std::unique_ptr<AppLaunchSigninScreen> signin_screen_;
diff --git a/chrome/browser/chromeos/login/arc_kiosk_controller.cc b/chrome/browser/chromeos/login/arc_kiosk_controller.cc index b895e97c3..da04f6ec 100644 --- a/chrome/browser/chromeos/login/arc_kiosk_controller.cc +++ b/chrome/browser/chromeos/login/arc_kiosk_controller.cc
@@ -26,11 +26,11 @@ ArcKioskController::ArcKioskController(LoginDisplayHost* host, OobeUI* oobe_ui) : host_(host), - arc_kiosk_splash_screen_actor_(oobe_ui->GetArcKioskSplashScreenActor()), + arc_kiosk_splash_screen_view_(oobe_ui->GetArcKioskSplashScreenView()), weak_ptr_factory_(this) {} ArcKioskController::~ArcKioskController() { - arc_kiosk_splash_screen_actor_->SetDelegate(nullptr); + arc_kiosk_splash_screen_view_->SetDelegate(nullptr); } void ArcKioskController::StartArcKiosk(const AccountId& account_id) { @@ -38,8 +38,8 @@ host_->GetWebUILoginView()->SetUIEnabled(true); - arc_kiosk_splash_screen_actor_->SetDelegate(this); - arc_kiosk_splash_screen_actor_->Show(); + arc_kiosk_splash_screen_view_->SetDelegate(this); + arc_kiosk_splash_screen_view_->Show(); splash_wait_timer_.Start(FROM_HERE, kArcKioskSplashScreenMinTime, base::Bind(&ArcKioskController::CloseSplashScreen, weak_ptr_factory_.GetWeakPtr())); @@ -107,14 +107,14 @@ // a profile load, so invalidate the delegate now. UserSessionManager::GetInstance()->DelegateDeleted(this); ArcKioskAppService::Get(profile_)->SetDelegate(this); - arc_kiosk_splash_screen_actor_->UpdateArcKioskState( - ArcKioskSplashScreenActor::ArcKioskState::WAITING_APP_LAUNCH); + arc_kiosk_splash_screen_view_->UpdateArcKioskState( + ArcKioskSplashScreenView::ArcKioskState::WAITING_APP_LAUNCH); } void ArcKioskController::OnAppStarted() { DVLOG(1) << "ARC Kiosk launch succeeded, wait for app window."; - arc_kiosk_splash_screen_actor_->UpdateArcKioskState( - ArcKioskSplashScreenActor::ArcKioskState::WAITING_APP_WINDOW); + arc_kiosk_splash_screen_view_->UpdateArcKioskState( + ArcKioskSplashScreenView::ArcKioskState::WAITING_APP_WINDOW); } void ArcKioskController::OnAppWindowLaunched() {
diff --git a/chrome/browser/chromeos/login/arc_kiosk_controller.h b/chrome/browser/chromeos/login/arc_kiosk_controller.h index 5062836..8408535 100644 --- a/chrome/browser/chromeos/login/arc_kiosk_controller.h +++ b/chrome/browser/chromeos/login/arc_kiosk_controller.h
@@ -8,7 +8,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h" -#include "chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_view.h" #include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chromeos/login/auth/login_performer.h" @@ -31,7 +31,7 @@ class ArcKioskController : public LoginPerformer::Delegate, public UserSessionManagerDelegate, public ArcKioskAppService::Delegate, - public ArcKioskSplashScreenActor::Delegate { + public ArcKioskSplashScreenView::Delegate { public: ArcKioskController(LoginDisplayHost* host, OobeUI* oobe_ui); @@ -58,13 +58,13 @@ void OnAppStarted() override; void OnAppWindowLaunched() override; - // ArcKioskSplashScreenActor::Delegate implementation: + // ArcKioskSplashScreenView::Delegate implementation: void OnCancelArcKioskLaunch() override; // LoginDisplayHost owns itself. LoginDisplayHost* const host_; // Owned by OobeUI. - ArcKioskSplashScreenActor* const arc_kiosk_splash_screen_actor_; + ArcKioskSplashScreenView* const arc_kiosk_splash_screen_view_; // Not owning here. Profile* profile_ = nullptr;
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc index 62c3995..9f7e45d3 100644 --- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc +++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc
@@ -46,24 +46,24 @@ AutoEnrollmentCheckScreen::AutoEnrollmentCheckScreen( BaseScreenDelegate* base_screen_delegate, - AutoEnrollmentCheckScreenActor* actor) + AutoEnrollmentCheckScreenView* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_AUTO_ENROLLMENT_CHECK), - actor_(actor), + view_(view), auto_enrollment_controller_(nullptr), captive_portal_status_( NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN), auto_enrollment_state_(policy::AUTO_ENROLLMENT_STATE_IDLE), histogram_helper_(new ErrorScreensHistogramHelper("Enrollment")), weak_ptr_factory_(this) { - if (actor_) - actor_->SetDelegate(this); + if (view_) + view_->SetDelegate(this); } AutoEnrollmentCheckScreen::~AutoEnrollmentCheckScreen() { network_portal_detector::GetInstance()->RemoveObserver(this); - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(NULL); } void AutoEnrollmentCheckScreen::ClearState() { @@ -90,7 +90,7 @@ // Bring up the screen. It's important to do this before updating the UI, // because the latter may switch to the error screen, which needs to stay on // top. - actor_->Show(); + view_->Show(); histogram_helper_->OnScreenShow(); // Set up state change observers. @@ -121,10 +121,10 @@ void AutoEnrollmentCheckScreen::Hide() { } -void AutoEnrollmentCheckScreen::OnActorDestroyed( - AutoEnrollmentCheckScreenActor* actor) { - if (actor_ == actor) - actor_ = NULL; +void AutoEnrollmentCheckScreen::OnViewDestroyed( + AutoEnrollmentCheckScreenView* view) { + if (view_ == view) + view_ = nullptr; } void AutoEnrollmentCheckScreen::OnPortalDetectionCompleted(
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h index b9ac5f1..1ac416e0 100644 --- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h +++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h
@@ -10,7 +10,7 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_actor.h" +#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h" #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" #include "chrome/browser/chromeos/login/screens/error_screen.h" @@ -29,12 +29,12 @@ // the error screen upon failures. Similar to a screen controller, but it // doesn't actually drive a dedicated screen. class AutoEnrollmentCheckScreen - : public AutoEnrollmentCheckScreenActor::Delegate, + : public AutoEnrollmentCheckScreenView::Delegate, public BaseScreen, public NetworkPortalDetector::Observer { public: AutoEnrollmentCheckScreen(BaseScreenDelegate* base_screen_delegate, - AutoEnrollmentCheckScreenActor* actor); + AutoEnrollmentCheckScreenView* view); ~AutoEnrollmentCheckScreen() override; static AutoEnrollmentCheckScreen* Get(ScreenManager* manager); @@ -51,8 +51,8 @@ void Show() override; void Hide() override; - // AutoEnrollmentCheckScreenActor::Delegate implementation: - void OnActorDestroyed(AutoEnrollmentCheckScreenActor* actor) override; + // AutoEnrollmentCheckScreenView::Delegate implementation: + void OnViewDestroyed(AutoEnrollmentCheckScreenView* view) override; // NetworkPortalDetector::Observer implementation: void OnPortalDetectionCompleted( @@ -90,7 +90,7 @@ // The user requested a connection attempt to be performed. void OnConnectRequested(); - AutoEnrollmentCheckScreenActor* actor_; + AutoEnrollmentCheckScreenView* view_; AutoEnrollmentController* auto_enrollment_controller_; std::unique_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription>
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_actor.h b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h similarity index 67% rename from chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_actor.h rename to chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h index 1079ad3..3259790 100644 --- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_actor.h +++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h
@@ -2,26 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_VIEW_H_ namespace chromeos { // Interface between auto-enrollment check screen and its representation. -// Note, do not forget to call OnActorDestroyed in the dtor. -class AutoEnrollmentCheckScreenActor { +// Note, do not forget to call OnViewDestroyed in the dtor. +class AutoEnrollmentCheckScreenView { public: // Allows us to get info from auto-enrollment check screen that we need. class Delegate { public: virtual ~Delegate() {} - // This method is called, when actor is being destroyed. Note, if Delegate + // This method is called, when view is being destroyed. Note, if Delegate // is destroyed earlier then it has to call SetDelegate(NULL). - virtual void OnActorDestroyed(AutoEnrollmentCheckScreenActor* actor) = 0; + virtual void OnViewDestroyed(AutoEnrollmentCheckScreenView* view) = 0; }; - virtual ~AutoEnrollmentCheckScreenActor() {} + virtual ~AutoEnrollmentCheckScreenView() {} virtual void Show() = 0; virtual void SetDelegate(Delegate* delegate) = 0; @@ -29,4 +29,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc index 73db1d4a..3c7483a0 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
@@ -74,9 +74,9 @@ } EnrollmentScreen::EnrollmentScreen(BaseScreenDelegate* base_screen_delegate, - EnrollmentScreenActor* actor) + EnrollmentScreenView* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_ENROLLMENT), - actor_(actor), + view_(view), weak_ptr_factory_(this) { retry_policy_.num_errors_to_ignore = 0; retry_policy_.initial_delay_ms = kInitialDelayMS; @@ -126,7 +126,7 @@ ? policy::EnrollmentConfig::MODE_ATTESTATION_FORCED : policy::EnrollmentConfig::MODE_ATTESTATION; } - actor_->SetParameters(this, config_); + view_->SetParameters(this, config_); enrollment_helper_ = nullptr; } @@ -182,14 +182,14 @@ } void EnrollmentScreen::Hide() { - actor_->Hide(); + view_->Hide(); weak_ptr_factory_.InvalidateWeakPtrs(); } void EnrollmentScreen::AuthenticateUsingAttestation() { VLOG(1) << "Authenticating using attestation."; elapsed_timer_.reset(new base::ElapsedTimer()); - actor_->Show(); + view_->Show(); CreateEnrollmentHelper(); enrollment_helper_->EnrollUsingAttestation(); } @@ -202,7 +202,7 @@ UMA(enrollment_failed_once_ ? policy::kMetricEnrollmentRestarted : policy::kMetricEnrollmentStarted); - actor_->ShowEnrollmentSpinnerScreen(); + view_->ShowEnrollmentSpinnerScreen(); CreateEnrollmentHelper(); enrollment_helper_->EnrollUsingAuthCode( auth_code, shark_controller_ != nullptr /* fetch_additional_token */); @@ -256,7 +256,7 @@ void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) { RecordEnrollmentErrorMetrics(); - actor_->ShowAuthError(error); + view_->ShowAuthError(error); } void EnrollmentScreen::OnEnrollmentError(policy::EnrollmentStatus status) { @@ -272,7 +272,7 @@ current_auth_ == AUTH_ATTESTATION && AdvanceToNextAuth()) { Show(); } else { - actor_->ShowEnrollmentStatus(status); + view_->ShowEnrollmentStatus(status); if (UsingHandsOffEnrollment()) AutomaticRetry(); } @@ -281,7 +281,7 @@ void EnrollmentScreen::OnOtherError( EnterpriseEnrollmentHelper::OtherError error) { RecordEnrollmentErrorMetrics(); - actor_->ShowOtherError(error); + view_->ShowOtherError(error); if (UsingHandsOffEnrollment()) AutomaticRetry(); } @@ -325,10 +325,10 @@ policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); connector->GetDeviceCloudPolicyManager()->core()->RefreshSoon(); - actor_->ShowEnrollmentStatus( + view_->ShowEnrollmentStatus( policy::EnrollmentStatus::ForStatus(policy::EnrollmentStatus::SUCCESS)); } else { - actor_->ShowEnrollmentStatus(policy::EnrollmentStatus::ForStatus( + view_->ShowEnrollmentStatus(policy::EnrollmentStatus::ForStatus( policy::EnrollmentStatus::ATTRIBUTE_UPDATE_FAILED)); } } @@ -345,7 +345,7 @@ std::string asset_id = policy ? policy->annotated_asset_id() : std::string(); std::string location = policy ? policy->annotated_location() : std::string(); - actor_->ShowAttributePromptScreen(asset_id, location); + view_->ShowAttributePromptScreen(asset_id, location); } void EnrollmentScreen::SendEnrollmentAuthToken(const std::string& token) { @@ -360,7 +360,7 @@ if (UsingHandsOffEnrollment()) { OnConfirmationClosed(); } else { - actor_->ShowEnrollmentStatus( + view_->ShowEnrollmentStatus( policy::EnrollmentStatus::ForStatus(policy::EnrollmentStatus::SUCCESS)); } } @@ -370,8 +370,8 @@ } void EnrollmentScreen::ShowSigninScreen() { - actor_->Show(); - actor_->ShowSigninScreen(); + view_->Show(); + view_->ShowSigninScreen(); } void EnrollmentScreen::RecordEnrollmentErrorMetrics() { @@ -383,7 +383,7 @@ void EnrollmentScreen::JoinDomain(OnDomainJoinedCallback on_joined_callback) { on_joined_callback_ = std::move(on_joined_callback); - actor_->ShowAdJoin(); + view_->ShowAdJoin(); } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.h b/chrome/browser/chromeos/login/enrollment/enrollment_screen.h index 6e547f6b..7cabf4c8 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.h +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.h
@@ -14,7 +14,7 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" +#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h" #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" #include "chrome/browser/chromeos/policy/active_directory_join_delegate.h" @@ -41,11 +41,11 @@ class EnrollmentScreen : public BaseScreen, public EnterpriseEnrollmentHelper::EnrollmentStatusConsumer, - public EnrollmentScreenActor::Controller, + public EnrollmentScreenView::Controller, public ActiveDirectoryJoinDelegate { public: EnrollmentScreen(BaseScreenDelegate* base_screen_delegate, - EnrollmentScreenActor* actor); + EnrollmentScreenView* view); ~EnrollmentScreen() override; static EnrollmentScreen* Get(ScreenManager* manager); @@ -61,7 +61,7 @@ void Show() override; void Hide() override; - // EnrollmentScreenActor::Controller implementation: + // EnrollmentScreenView::Controller implementation: void OnLoginDone(const std::string& user, const std::string& auth_code) override; void OnRetry() override; @@ -83,9 +83,7 @@ void JoinDomain(OnDomainJoinedCallback on_joined_callback) override; // Used for testing. - EnrollmentScreenActor* GetActor() { - return actor_; - } + EnrollmentScreenView* GetView() { return view_; } private: friend class EnrollmentScreenUnitTest; @@ -166,7 +164,7 @@ pairing_chromeos::ControllerPairingController* shark_controller_ = nullptr; - EnrollmentScreenActor* actor_; + EnrollmentScreenView* view_; policy::EnrollmentConfig config_; policy::EnrollmentConfig enrollment_config_; Auth current_auth_ = AUTH_OAUTH;
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc index a79d8dc2..3e210ce 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc
@@ -136,25 +136,25 @@ EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get(wcontroller); ASSERT_TRUE(enrollment_screen); - EnrollmentScreenActor* actor = enrollment_screen->GetActor(); - ASSERT_TRUE(actor); + EnrollmentScreenView* view = enrollment_screen->GetView(); + ASSERT_TRUE(view); test::JSChecker checker( LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents()); // Run through the flow - actor->Show(); + view->Show(); OobeScreenWaiter(OobeScreen::SCREEN_OOBE_ENROLLMENT).Wait(); checker.ExpectTrue( "window.getComputedStyle(document.getElementById('oauth-enroll-step-" "signin')).display !== 'none'"); - actor->ShowEnrollmentSpinnerScreen(); + view->ShowEnrollmentSpinnerScreen(); checker.ExpectTrue( "window.getComputedStyle(document.getElementById('oauth-enroll-step-" "working')).display !== 'none'"); - actor->ShowAttestationBasedEnrollmentSuccessScreen("fake domain"); + view->ShowAttestationBasedEnrollmentSuccessScreen("fake domain"); checker.ExpectTrue( "window.getComputedStyle(document.getElementById('oauth-enroll-step-abe-" "success')).display !== 'none'");
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc index e4b8bc6..dce186db 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc
@@ -77,7 +77,7 @@ // Creates the EnrollmentScreen and sets required parameters. void SetUpEnrollmentScreen() { enrollment_screen_.reset( - new EnrollmentScreen(&mock_delegate_, &mock_actor_)); + new EnrollmentScreen(&mock_delegate_, &mock_view_)); enrollment_screen_->SetParameters(enrollment_config_, &fake_controller_); } @@ -116,7 +116,7 @@ policy::EnrollmentConfig enrollment_config_; pairing_chromeos::FakeControllerPairingController fake_controller_; MockBaseScreenDelegate mock_delegate_; - MockEnrollmentScreenActor mock_actor_; + MockEnrollmentScreenView mock_view_; DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenUnitTest); };
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h b/chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h similarity index 91% rename from chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h rename to chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h index bcb27b10..9b43849 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_VIEW_H_ #include <string> @@ -18,8 +18,8 @@ namespace chromeos { -// Interface class for the enterprise enrollment screen actor. -class EnrollmentScreenActor { +// Interface class for the enterprise enrollment screen view. +class EnrollmentScreenView { public: // This defines the interface for controllers which will be called back when // something happens on the UI. @@ -37,9 +37,9 @@ const std::string& location) = 0; }; - virtual ~EnrollmentScreenActor() {} + virtual ~EnrollmentScreenView() {} - // Initializes the actor with parameters. + // Initializes the view with parameters. virtual void SetParameters(Controller* controller, const policy::EnrollmentConfig& config) = 0; @@ -78,4 +78,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.cc b/chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.cc index 6d9c0c8..1bf9f20 100644 --- a/chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.cc +++ b/chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.cc
@@ -11,24 +11,22 @@ MockAutoEnrollmentCheckScreen::MockAutoEnrollmentCheckScreen( BaseScreenDelegate* base_screen_delegate, - AutoEnrollmentCheckScreenActor* actor) - : AutoEnrollmentCheckScreen(base_screen_delegate, actor) { -} + AutoEnrollmentCheckScreenView* view) + : AutoEnrollmentCheckScreen(base_screen_delegate, view) {} MockAutoEnrollmentCheckScreen::~MockAutoEnrollmentCheckScreen() { } -MockAutoEnrollmentCheckScreenActor::MockAutoEnrollmentCheckScreenActor() +MockAutoEnrollmentCheckScreenView::MockAutoEnrollmentCheckScreenView() : screen_(NULL) { EXPECT_CALL(*this, MockSetDelegate(NotNull())).Times(AtLeast(1)); } - -MockAutoEnrollmentCheckScreenActor::~MockAutoEnrollmentCheckScreenActor() { +MockAutoEnrollmentCheckScreenView::~MockAutoEnrollmentCheckScreenView() { if (screen_) - screen_->OnActorDestroyed(this); + screen_->OnViewDestroyed(this); } -void MockAutoEnrollmentCheckScreenActor::SetDelegate(Delegate* screen) { +void MockAutoEnrollmentCheckScreenView::SetDelegate(Delegate* screen) { screen_ = screen; MockSetDelegate(screen); }
diff --git a/chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.h b/chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.h index b6dd5e1..ecd7f7f7 100644 --- a/chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.h +++ b/chrome/browser/chromeos/login/enrollment/mock_auto_enrollment_check_screen.h
@@ -6,7 +6,7 @@ #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_MOCK_AUTO_ENROLLMENT_CHECK_SCREEN_H_ #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.h" -#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_actor.h" +#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { @@ -14,15 +14,14 @@ class MockAutoEnrollmentCheckScreen : public AutoEnrollmentCheckScreen { public: MockAutoEnrollmentCheckScreen(BaseScreenDelegate* base_screen_delegate, - AutoEnrollmentCheckScreenActor* actor); + AutoEnrollmentCheckScreenView* view); ~MockAutoEnrollmentCheckScreen() override; }; -class MockAutoEnrollmentCheckScreenActor - : public AutoEnrollmentCheckScreenActor { +class MockAutoEnrollmentCheckScreenView : public AutoEnrollmentCheckScreenView { public: - MockAutoEnrollmentCheckScreenActor(); - ~MockAutoEnrollmentCheckScreenActor() override; + MockAutoEnrollmentCheckScreenView(); + ~MockAutoEnrollmentCheckScreenView() override; void SetDelegate(Delegate* screen) override;
diff --git a/chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.cc b/chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.cc index b2ce4a1..e4ac54a 100644 --- a/chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.cc +++ b/chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.cc
@@ -8,17 +8,14 @@ MockEnrollmentScreen::MockEnrollmentScreen( BaseScreenDelegate* base_screen_delegate, - EnrollmentScreenActor* actor) - : EnrollmentScreen(base_screen_delegate, actor) { -} + EnrollmentScreenView* view) + : EnrollmentScreen(base_screen_delegate, view) {} MockEnrollmentScreen::~MockEnrollmentScreen() { } -MockEnrollmentScreenActor::MockEnrollmentScreenActor() { -} +MockEnrollmentScreenView::MockEnrollmentScreenView() {} -MockEnrollmentScreenActor::~MockEnrollmentScreenActor() { -} +MockEnrollmentScreenView::~MockEnrollmentScreenView() {} } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h b/chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h index a9be5222..139c43b 100644 --- a/chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h +++ b/chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h
@@ -6,7 +6,7 @@ #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_MOCK_ENROLLMENT_SCREEN_H_ #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" -#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" +#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h" #include "chrome/browser/chromeos/policy/enrollment_config.h" #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" #include "google_apis/gaia/google_service_auth_error.h" @@ -17,15 +17,14 @@ class MockEnrollmentScreen : public EnrollmentScreen { public: MockEnrollmentScreen(BaseScreenDelegate* base_screen_delegate, - EnrollmentScreenActor* actor); + EnrollmentScreenView* view); ~MockEnrollmentScreen() override; }; -class MockEnrollmentScreenActor - : public EnrollmentScreenActor { +class MockEnrollmentScreenView : public EnrollmentScreenView { public: - MockEnrollmentScreenActor(); - virtual ~MockEnrollmentScreenActor(); + MockEnrollmentScreenView(); + virtual ~MockEnrollmentScreenView(); MOCK_METHOD2(SetParameters, void(Controller*, const policy::EnrollmentConfig& config));
diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc index d6685315..0d7112a 100644 --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc
@@ -763,7 +763,7 @@ // Configure network should bring up lock screen for owner. OobeScreenWaiter lock_screen_waiter(OobeScreen::SCREEN_ACCOUNT_PICKER); - static_cast<AppLaunchSplashScreenActor::Delegate*>(GetAppLaunchController()) + static_cast<AppLaunchSplashScreenView::Delegate*>(GetAppLaunchController()) ->OnConfigureNetwork(); lock_screen_waiter.Wait();
diff --git a/chrome/browser/chromeos/login/lock/webui_screen_locker.cc b/chrome/browser/chromeos/login/lock/webui_screen_locker.cc index 8312e2f..659e0f4 100644 --- a/chrome/browser/chromeos/login/lock/webui_screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/webui_screen_locker.cc
@@ -431,14 +431,14 @@ if (new_bounds.IsEmpty()) { // Keyboard has been hidden. if (GetOobeUI()) { - GetOobeUI()->GetCoreOobeActor()->ShowControlBar(true); - GetOobeUI()->GetCoreOobeActor()->ShowPinKeyboard(true); + GetOobeUI()->GetCoreOobeView()->ShowControlBar(true); + GetOobeUI()->GetCoreOobeView()->ShowPinKeyboard(true); } } else { // Keyboard has been shown. if (GetOobeUI()) { - GetOobeUI()->GetCoreOobeActor()->ShowControlBar(false); - GetOobeUI()->GetCoreOobeActor()->ShowPinKeyboard(false); + GetOobeUI()->GetCoreOobeView()->ShowControlBar(false); + GetOobeUI()->GetCoreOobeView()->ShowPinKeyboard(false); } } } @@ -463,8 +463,8 @@ if (GetOobeUI()) { const gfx::Size& size = primary_display.size(); - GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), - size.height()); + GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), + size.height()); } }
diff --git a/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc b/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc index 472d8de..3e5b8d1 100644 --- a/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc +++ b/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc
@@ -43,15 +43,12 @@ class FocusPODWaiter { public: FocusPODWaiter() : focused_(false), runner_(new content::MessageLoopRunner) { - GetOobeUI() - ->signin_screen_handler_for_test() - ->SetFocusPODCallbackForTesting( - base::Bind(&FocusPODWaiter::OnFocusPOD, base::Unretained(this))); + GetOobeUI()->signin_screen_handler()->SetFocusPODCallbackForTesting( + base::Bind(&FocusPODWaiter::OnFocusPOD, base::Unretained(this))); } ~FocusPODWaiter() { - GetOobeUI() - ->signin_screen_handler_for_test() - ->SetFocusPODCallbackForTesting(base::Closure()); + GetOobeUI()->signin_screen_handler()->SetFocusPODCallbackForTesting( + base::Closure()); } void OnFocusPOD() { @@ -70,9 +67,8 @@ if (focused_) return; runner_->Run(); - GetOobeUI() - ->signin_screen_handler_for_test() - ->SetFocusPODCallbackForTesting(base::Closure()); + GetOobeUI()->signin_screen_handler()->SetFocusPODCallbackForTesting( + base::Closure()); runner_ = NULL; }
diff --git a/chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h b/chrome/browser/chromeos/login/screens/app_launch_splash_screen_view.h similarity index 92% rename from chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h rename to chrome/browser/chromeos/login/screens/app_launch_splash_screen_view.h index 27163215..d7dcfe8 100644 --- a/chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/app_launch_splash_screen_view.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_APP_LAUNCH_SPLASH_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_APP_LAUNCH_SPLASH_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_APP_LAUNCH_SPLASH_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_APP_LAUNCH_SPLASH_SCREEN_VIEW_H_ #include "base/strings/string16.h" namespace chromeos { // Interface for UI implemenations of the ApplaunchSplashScreen. -class AppLaunchSplashScreenActor { +class AppLaunchSplashScreenView { public: enum AppLaunchState { APP_LAUNCH_STATE_LOADING_AUTH_FILE, @@ -41,9 +41,9 @@ virtual ~Delegate() {} }; - virtual ~AppLaunchSplashScreenActor() {} + virtual ~AppLaunchSplashScreenView() {} - // Sets screen this actor belongs to. + // Sets screen this view belongs to. virtual void SetDelegate(Delegate* screen) = 0; // Shows the contents of the screen. @@ -67,4 +67,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_APP_LAUNCH_SPLASH_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_APP_LAUNCH_SPLASH_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_actor.h b/chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_view.h similarity index 80% rename from chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_actor.h rename to chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_view.h index b6a8c85..3e96825 100644 --- a/chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_view.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_KIOSK_SPLASH_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_KIOSK_SPLASH_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_KIOSK_SPLASH_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_KIOSK_SPLASH_SCREEN_VIEW_H_ namespace chromeos { // Interface for UI implemenations of the ArcKioskSplashScreen. -class ArcKioskSplashScreenActor { +class ArcKioskSplashScreenView { public: enum class ArcKioskState { STARTING_SESSION, @@ -29,9 +29,9 @@ DISALLOW_COPY_AND_ASSIGN(Delegate); }; - ArcKioskSplashScreenActor() = default; + ArcKioskSplashScreenView() = default; - virtual ~ArcKioskSplashScreenActor() = default; + virtual ~ArcKioskSplashScreenView() = default; // Shows the contents of the screen. virtual void Show() = 0; @@ -39,13 +39,13 @@ // Set the current ARC kiosk state. virtual void UpdateArcKioskState(ArcKioskState state) = 0; - // Sets screen this actor belongs to. + // Sets screen this view belongs to. virtual void SetDelegate(Delegate* delegate) = 0; private: - DISALLOW_COPY_AND_ASSIGN(ArcKioskSplashScreenActor); + DISALLOW_COPY_AND_ASSIGN(ArcKioskSplashScreenView); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_KIOSK_SPLASH_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_KIOSK_SPLASH_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.cc b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.cc index 8fbd907a..34b0abf 100644 --- a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.cc +++ b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.cc
@@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.h" -#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view.h" #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/metrics/metrics_reporting_state.h" @@ -17,30 +17,30 @@ ArcTermsOfServiceScreen::ArcTermsOfServiceScreen( BaseScreenDelegate* base_screen_delegate, - ArcTermsOfServiceScreenActor* actor) + ArcTermsOfServiceScreenView* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE), - actor_(actor) { - DCHECK(actor_); - if (actor_) - actor_->AddObserver(this); + view_(view) { + DCHECK(view_); + if (view_) + view_->AddObserver(this); } ArcTermsOfServiceScreen::~ArcTermsOfServiceScreen() { - if (actor_) - actor_->RemoveObserver(this); + if (view_) + view_->RemoveObserver(this); } void ArcTermsOfServiceScreen::Show() { - if (!actor_) + if (!view_) return; // Show the screen. - actor_->Show(); + view_->Show(); } void ArcTermsOfServiceScreen::Hide() { - if (actor_) - actor_->Hide(); + if (view_) + view_->Hide(); } void ArcTermsOfServiceScreen::OnSkip() { @@ -51,10 +51,10 @@ Finish(BaseScreenDelegate::ARC_TERMS_OF_SERVICE_FINISHED); } -void ArcTermsOfServiceScreen::OnActorDestroyed( - ArcTermsOfServiceScreenActor* actor) { - DCHECK_EQ(actor, actor_); - actor_ = nullptr; +void ArcTermsOfServiceScreen::OnViewDestroyed( + ArcTermsOfServiceScreenView* view) { + DCHECK_EQ(view, view_); + view_ = nullptr; } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.h b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.h index fff5e27..cad2d8ae 100644 --- a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.h +++ b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen.h
@@ -8,32 +8,32 @@ #include <string> #include "base/macros.h" -#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor_observer.h" +#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view_observer.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" namespace chromeos { -class ArcTermsOfServiceScreenActor; +class ArcTermsOfServiceScreenView; class BaseScreenDelegate; class ArcTermsOfServiceScreen : public BaseScreen, - public ArcTermsOfServiceScreenActorObserver { + public ArcTermsOfServiceScreenViewObserver { public: ArcTermsOfServiceScreen(BaseScreenDelegate* base_screen_delegate, - ArcTermsOfServiceScreenActor* actor); + ArcTermsOfServiceScreenView* view); ~ArcTermsOfServiceScreen() override; // BaseScreen: void Show() override; void Hide() override; - // ArcTermsOfServiceScreenActorObserver: + // ArcTermsOfServiceScreenViewObserver: void OnSkip() override; void OnAccept() override; - void OnActorDestroyed(ArcTermsOfServiceScreenActor* actor) override; + void OnViewDestroyed(ArcTermsOfServiceScreenView* view) override; private: - ArcTermsOfServiceScreenActor* actor_; + ArcTermsOfServiceScreenView* view_; DISALLOW_COPY_AND_ASSIGN(ArcTermsOfServiceScreen); };
diff --git a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor_observer.h b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor_observer.h deleted file mode 100644 index cd1346ee..0000000 --- a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor_observer.h +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_ACTOR_OBSERVER_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_ACTOR_OBSERVER_H_ - -#include "base/macros.h" - -namespace chromeos { - -class ArcTermsOfServiceScreenActor; - -class ArcTermsOfServiceScreenActorObserver { - public: - virtual ~ArcTermsOfServiceScreenActorObserver() = default; - - // Called when the user skips the PlayStore Terms of Service. - virtual void OnSkip() = 0; - - // Called when the user accepts the PlayStore Terms of Service. - virtual void OnAccept() = 0; - - // Called when actor is destroyed so there is no dead reference to it. - virtual void OnActorDestroyed(ArcTermsOfServiceScreenActor* actor) = 0; - - protected: - ArcTermsOfServiceScreenActorObserver() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(ArcTermsOfServiceScreenActorObserver); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_ACTOR_OBSERVER_H_
diff --git a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor.h b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view.h similarity index 61% rename from chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor.h rename to chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view.h index a30b60a..7b75f78 100644 --- a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_VIEW_H_ #include <string> @@ -11,18 +11,18 @@ namespace chromeos { -class ArcTermsOfServiceScreenActorObserver; +class ArcTermsOfServiceScreenViewObserver; // Interface for dependency injection between TermsOfServiceScreen and its // WebUI representation. -class ArcTermsOfServiceScreenActor { +class ArcTermsOfServiceScreenView { public: - virtual ~ArcTermsOfServiceScreenActor() = default; + virtual ~ArcTermsOfServiceScreenView() = default; - // Adds/Removes observer for actor. - virtual void AddObserver(ArcTermsOfServiceScreenActorObserver* observer) = 0; + // Adds/Removes observer for view. + virtual void AddObserver(ArcTermsOfServiceScreenViewObserver* observer) = 0; virtual void RemoveObserver( - ArcTermsOfServiceScreenActorObserver* observer) = 0; + ArcTermsOfServiceScreenViewObserver* observer) = 0; // Shows the contents of the screen. virtual void Show() = 0; @@ -31,12 +31,12 @@ virtual void Hide() = 0; protected: - ArcTermsOfServiceScreenActor() = default; + ArcTermsOfServiceScreenView() = default; private: - DISALLOW_COPY_AND_ASSIGN(ArcTermsOfServiceScreenActor); + DISALLOW_COPY_AND_ASSIGN(ArcTermsOfServiceScreenView); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view_observer.h b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view_observer.h new file mode 100644 index 0000000..f539027 --- /dev/null +++ b/chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view_observer.h
@@ -0,0 +1,36 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_VIEW_OBSERVER_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_VIEW_OBSERVER_H_ + +#include "base/macros.h" + +namespace chromeos { + +class ArcTermsOfServiceScreenView; + +class ArcTermsOfServiceScreenViewObserver { + public: + virtual ~ArcTermsOfServiceScreenViewObserver() = default; + + // Called when the user skips the PlayStore Terms of Service. + virtual void OnSkip() = 0; + + // Called when the user accepts the PlayStore Terms of Service. + virtual void OnAccept() = 0; + + // Called when the view is destroyed so there is no dead reference to it. + virtual void OnViewDestroyed(ArcTermsOfServiceScreenView* view) = 0; + + protected: + ArcTermsOfServiceScreenViewObserver() = default; + + private: + DISALLOW_COPY_AND_ASSIGN(ArcTermsOfServiceScreenViewObserver); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ARC_TERMS_OF_SERVICE_SCREEN_VIEW_OBSERVER_H_
diff --git a/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc b/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc index 3c9128bb..08a536c 100644 --- a/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc +++ b/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc
@@ -18,22 +18,22 @@ ControllerPairingScreen::ControllerPairingScreen( BaseScreenDelegate* base_screen_delegate, Delegate* delegate, - ControllerPairingScreenActor* actor, + ControllerPairingScreenView* view, ControllerPairingController* shark_controller) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_CONTROLLER_PAIRING), delegate_(delegate), - actor_(actor), + view_(view), shark_controller_(shark_controller), current_stage_(ControllerPairingController::STAGE_NONE), device_preselected_(false) { - actor_->SetDelegate(this); + view_->SetDelegate(this); shark_controller_->AddObserver(this); } ControllerPairingScreen::~ControllerPairingScreen() { - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(nullptr); shark_controller_->RemoveObserver(this); } @@ -42,8 +42,8 @@ return; base::DictionaryValue diff; context_.GetChangesAndReset(&diff); - if (actor_) - actor_->OnContextChanged(diff); + if (view_) + view_->OnContextChanged(diff); } bool ControllerPairingScreen::ExpectStageIs(Stage stage) const { @@ -55,14 +55,14 @@ } void ControllerPairingScreen::Show() { - if (actor_) - actor_->Show(); + if (view_) + view_->Show(); shark_controller_->StartPairing(); } void ControllerPairingScreen::Hide() { - if (actor_) - actor_->Hide(); + if (view_) + view_->Hide(); } void ControllerPairingScreen::PairingStageChanged(Stage new_stage) { @@ -160,10 +160,10 @@ CommitContextChanges(); } -void ControllerPairingScreen::OnActorDestroyed( - ControllerPairingScreenActor* actor) { - if (actor_ == actor) - actor_ = NULL; +void ControllerPairingScreen::OnViewDestroyed( + ControllerPairingScreenView* view) { + if (view_ == view) + view_ = nullptr; } // Overridden from ControllerPairingView::Delegate:
diff --git a/chrome/browser/chromeos/login/screens/controller_pairing_screen.h b/chrome/browser/chromeos/login/screens/controller_pairing_screen.h index 9305e14..3cd02c7 100644 --- a/chrome/browser/chromeos/login/screens/controller_pairing_screen.h +++ b/chrome/browser/chromeos/login/screens/controller_pairing_screen.h
@@ -8,7 +8,7 @@ #include "base/macros.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_view.h" #include "components/login/screens/screen_context.h" #include "components/pairing/controller_pairing_controller.h" @@ -17,7 +17,7 @@ class ControllerPairingScreen : public BaseScreen, public pairing_chromeos::ControllerPairingController::Observer, - public ControllerPairingScreenActor::Delegate { + public ControllerPairingScreenView::Delegate { public: class Delegate { public: @@ -33,7 +33,7 @@ ControllerPairingScreen( BaseScreenDelegate* base_screen_delegate, Delegate* delegate, - ControllerPairingScreenActor* actor, + ControllerPairingScreenView* view, pairing_chromeos::ControllerPairingController* shark_controller); ~ControllerPairingScreen() override; @@ -52,13 +52,13 @@ void DiscoveredDevicesListChanged() override; // Overridden from ControllerPairingView::Delegate: - void OnActorDestroyed(ControllerPairingScreenActor* actor) override; + void OnViewDestroyed(ControllerPairingScreenView* view) override; void OnScreenContextChanged(const base::DictionaryValue& diff) override; void OnUserActed(const std::string& action) override; Delegate* delegate_; - ControllerPairingScreenActor* actor_; + ControllerPairingScreenView* view_; // Controller performing pairing. Owned by the wizard controller. pairing_chromeos::ControllerPairingController* shark_controller_;
diff --git a/chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.cc b/chrome/browser/chromeos/login/screens/controller_pairing_screen_view.cc similarity index 92% rename from chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.cc rename to chrome/browser/chromeos/login/screens/controller_pairing_screen_view.cc index 9cd894f9..91cda03 100644 --- a/chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.cc +++ b/chrome/browser/chromeos/login/screens/controller_pairing_screen_view.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_view.h" namespace chromeos { @@ -43,10 +43,8 @@ } // namespace controller_pairing -ControllerPairingScreenActor::ControllerPairingScreenActor() { -} +ControllerPairingScreenView::ControllerPairingScreenView() {} -ControllerPairingScreenActor::~ControllerPairingScreenActor() { -} +ControllerPairingScreenView::~ControllerPairingScreenView() {} } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h b/chrome/browser/chromeos/login/screens/controller_pairing_screen_view.h similarity index 88% rename from chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h rename to chrome/browser/chromeos/login/screens/controller_pairing_screen_view.h index 3796790..739d4a6 100644 --- a/chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/controller_pairing_screen_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_VIEW_H_ #include <string> @@ -59,18 +59,18 @@ } // namespace controller_pairing -class ControllerPairingScreenActor { +class ControllerPairingScreenView { public: class Delegate { public: virtual ~Delegate() {} - virtual void OnActorDestroyed(ControllerPairingScreenActor* actor) = 0; + virtual void OnViewDestroyed(ControllerPairingScreenView* view) = 0; virtual void OnScreenContextChanged(const base::DictionaryValue& diff) = 0; virtual void OnUserActed(const std::string& action) = 0; }; - ControllerPairingScreenActor(); - virtual ~ControllerPairingScreenActor(); + ControllerPairingScreenView(); + virtual ~ControllerPairingScreenView(); virtual void Show() = 0; virtual void Hide() = 0; @@ -79,9 +79,9 @@ virtual content::BrowserContext* GetBrowserContext() = 0; private: - DISALLOW_COPY_AND_ASSIGN(ControllerPairingScreenActor); + DISALLOW_COPY_AND_ASSIGN(ControllerPairingScreenView); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/core_oobe_actor.h b/chrome/browser/chromeos/login/screens/core_oobe_view.h similarity index 87% rename from chrome/browser/chromeos/login/screens/core_oobe_actor.h rename to chrome/browser/chromeos/login/screens/core_oobe_view.h index 1200caa..4b5a0f9 100644 --- a/chrome/browser/chromeos/login/screens/core_oobe_actor.h +++ b/chrome/browser/chromeos/login/screens/core_oobe_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_ #include <string> @@ -15,9 +15,9 @@ namespace chromeos { -class CoreOobeActor { +class CoreOobeView { public: - virtual ~CoreOobeActor() {} + virtual ~CoreOobeView() {} virtual void ShowSignInError(int login_attempts, const std::string& error_text, @@ -49,4 +49,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/device_disabled_screen.cc b/chrome/browser/chromeos/login/screens/device_disabled_screen.cc index 5bf41c5..66d644c 100644 --- a/chrome/browser/chromeos/login/screens/device_disabled_screen.cc +++ b/chrome/browser/chromeos/login/screens/device_disabled_screen.cc
@@ -15,30 +15,30 @@ DeviceDisabledScreen::DeviceDisabledScreen( BaseScreenDelegate* base_screen_delegate, - DeviceDisabledScreenActor* actor) + DeviceDisabledScreenView* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_DEVICE_DISABLED), - actor_(actor), + view_(view), device_disabling_manager_( g_browser_process->platform_part()->device_disabling_manager()), showing_(false) { - DCHECK(actor_); - if (actor_) - actor_->SetDelegate(this); + DCHECK(view_); + if (view_) + view_->SetDelegate(this); device_disabling_manager_->AddObserver(this); } DeviceDisabledScreen::~DeviceDisabledScreen() { - if (actor_) - actor_->SetDelegate(nullptr); + if (view_) + view_->SetDelegate(nullptr); device_disabling_manager_->RemoveObserver(this); } void DeviceDisabledScreen::Show() { - if (!actor_ || showing_) + if (!view_ || showing_) return; showing_ = true; - actor_->Show(); + view_->Show(); } void DeviceDisabledScreen::Hide() { @@ -46,13 +46,13 @@ return; showing_ = false; - if (actor_) - actor_->Hide(); + if (view_) + view_->Hide(); } -void DeviceDisabledScreen::OnActorDestroyed(DeviceDisabledScreenActor* actor) { - if (actor_ == actor) - actor_ = nullptr; +void DeviceDisabledScreen::OnViewDestroyed(DeviceDisabledScreenView* view) { + if (view_ == view) + view_ = nullptr; } const std::string& DeviceDisabledScreen::GetEnrollmentDomain() const { @@ -65,8 +65,8 @@ void DeviceDisabledScreen::OnDisabledMessageChanged( const std::string& disabled_message) { - if (actor_) - actor_->UpdateMessage(disabled_message); + if (view_) + view_->UpdateMessage(disabled_message); } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/device_disabled_screen.h b/chrome/browser/chromeos/login/screens/device_disabled_screen.h index 6aff9bb..586dbb7 100644 --- a/chrome/browser/chromeos/login/screens/device_disabled_screen.h +++ b/chrome/browser/chromeos/login/screens/device_disabled_screen.h
@@ -7,7 +7,7 @@ #include "base/macros.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/screens/device_disabled_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/device_disabled_screen_view.h" #include "chrome/browser/chromeos/system/device_disabling_manager.h" namespace chromeos { @@ -20,19 +20,19 @@ // Screen informing the user that the device has been disabled by its owner. class DeviceDisabledScreen : public BaseScreen, - public DeviceDisabledScreenActor::Delegate, + public DeviceDisabledScreenView::Delegate, public system::DeviceDisablingManager::Observer { public: DeviceDisabledScreen(BaseScreenDelegate* base_screen_delegate, - DeviceDisabledScreenActor* actor); + DeviceDisabledScreenView* view); ~DeviceDisabledScreen() override; // BaseScreen: void Show() override; void Hide() override; - // DeviceDisabledScreenActor::Delegate: - void OnActorDestroyed(DeviceDisabledScreenActor* actor) override; + // DeviceDisabledScreenView::Delegate: + void OnViewDestroyed(DeviceDisabledScreenView* view) override; const std::string& GetEnrollmentDomain() const override; const std::string& GetMessage() const override; @@ -40,7 +40,7 @@ void OnDisabledMessageChanged(const std::string& disabled_message) override; private: - DeviceDisabledScreenActor* actor_; + DeviceDisabledScreenView* view_; system::DeviceDisablingManager* device_disabling_manager_; // Whether the screen is currently showing.
diff --git a/chrome/browser/chromeos/login/screens/device_disabled_screen_actor.h b/chrome/browser/chromeos/login/screens/device_disabled_screen_view.h similarity index 77% rename from chrome/browser/chromeos/login/screens/device_disabled_screen_actor.h rename to chrome/browser/chromeos/login/screens/device_disabled_screen_view.h index 7fdcc7d..bd063d7 100644 --- a/chrome/browser/chromeos/login/screens/device_disabled_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/device_disabled_screen_view.h
@@ -2,25 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_DEVICE_DISABLED_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_DEVICE_DISABLED_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_DEVICE_DISABLED_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_DEVICE_DISABLED_SCREEN_VIEW_H_ #include <string> namespace chromeos { // Interface between the device disabled screen and its representation. -class DeviceDisabledScreenActor { +class DeviceDisabledScreenView { public: // Allows the representation to access information about the screen. class Delegate { public: - virtual ~Delegate() { - } + virtual ~Delegate() {} - // Called when the actor is being destroyed. Note that if the Delegate is + // Called when the view is being destroyed. Note that if the Delegate is // destroyed first, it must call SetDelegate(nullptr). - virtual void OnActorDestroyed(DeviceDisabledScreenActor* actor) = 0; + virtual void OnViewDestroyed(DeviceDisabledScreenView* view) = 0; // Returns the domain that owns the device. virtual const std::string& GetEnrollmentDomain() const = 0; @@ -29,8 +28,7 @@ virtual const std::string& GetMessage() const = 0; }; - virtual ~DeviceDisabledScreenActor() { - } + virtual ~DeviceDisabledScreenView() {} virtual void Show() = 0; virtual void Hide() = 0; @@ -40,5 +38,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_DEVICE_DISABLED_SCREEN_ACTOR_H_ - +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_DEVICE_DISABLED_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/enable_debugging_screen.cc b/chrome/browser/chromeos/login/screens/enable_debugging_screen.cc index 1cf93ee8..0bd6517 100644 --- a/chrome/browser/chromeos/login/screens/enable_debugging_screen.cc +++ b/chrome/browser/chromeos/login/screens/enable_debugging_screen.cc
@@ -11,27 +11,27 @@ namespace chromeos { EnableDebuggingScreen::EnableDebuggingScreen(BaseScreenDelegate* delegate, - EnableDebuggingScreenActor* actor) + EnableDebuggingScreenView* view) : BaseScreen(delegate, OobeScreen::SCREEN_OOBE_ENABLE_DEBUGGING), - actor_(actor) { - DCHECK(actor_); - if (actor_) - actor_->SetDelegate(this); + view_(view) { + DCHECK(view_); + if (view_) + view_->SetDelegate(this); } EnableDebuggingScreen::~EnableDebuggingScreen() { - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(NULL); } void EnableDebuggingScreen::Show() { - if (actor_) - actor_->Show(); + if (view_) + view_->Show(); } void EnableDebuggingScreen::Hide() { - if (actor_) - actor_->Hide(); + if (view_) + view_->Hide(); } void EnableDebuggingScreen::OnExit(bool success) { @@ -39,10 +39,9 @@ BaseScreenDelegate::ENABLE_DEBUGGING_CANCELED); } -void EnableDebuggingScreen::OnActorDestroyed( - EnableDebuggingScreenActor* actor) { - if (actor_ == actor) - actor_ = NULL; +void EnableDebuggingScreen::OnViewDestroyed(EnableDebuggingScreenView* view) { + if (view_ == view) + view_ = NULL; } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/enable_debugging_screen.h b/chrome/browser/chromeos/login/screens/enable_debugging_screen.h index 36db96b1..d08f6e2 100644 --- a/chrome/browser/chromeos/login/screens/enable_debugging_screen.h +++ b/chrome/browser/chromeos/login/screens/enable_debugging_screen.h
@@ -9,17 +9,17 @@ #include "base/macros.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/screens/enable_debugging_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/enable_debugging_screen_view.h" namespace chromeos { // Representation independent class that controls screen showing enable // debugging screen to users. class EnableDebuggingScreen : public BaseScreen, - public EnableDebuggingScreenActor::Delegate { + public EnableDebuggingScreenView::Delegate { public: EnableDebuggingScreen(BaseScreenDelegate* delegate, - EnableDebuggingScreenActor* actor); + EnableDebuggingScreenView* view); ~EnableDebuggingScreen() override; // BaseScreen implementation: @@ -28,10 +28,10 @@ // EnableDebuggingScreenActor::Delegate implementation: void OnExit(bool success) override; - void OnActorDestroyed(EnableDebuggingScreenActor* actor) override; + void OnViewDestroyed(EnableDebuggingScreenView* view) override; private: - EnableDebuggingScreenActor* actor_; + EnableDebuggingScreenView* view_; DISALLOW_COPY_AND_ASSIGN(EnableDebuggingScreen); };
diff --git a/chrome/browser/chromeos/login/screens/enable_debugging_screen_actor.h b/chrome/browser/chromeos/login/screens/enable_debugging_screen_view.h similarity index 66% rename from chrome/browser/chromeos/login/screens/enable_debugging_screen_actor.h rename to chrome/browser/chromeos/login/screens/enable_debugging_screen_view.h index 66a1d99a..664fbae 100644 --- a/chrome/browser/chromeos/login/screens/enable_debugging_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/enable_debugging_screen_view.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ENABLE_DEBUGGING_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ENABLE_DEBUGGING_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ENABLE_DEBUGGING_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ENABLE_DEBUGGING_SCREEN_VIEW_H_ #include <string> namespace chromeos { // Interface between enable debugging screen and its representation. -// Note, do not forget to call OnActorDestroyed in the dtor. -class EnableDebuggingScreenActor { +// Note, do not forget to call OnViewDestroyed in the dtor. +class EnableDebuggingScreenView { public: // Allows us to get info from reset screen that we need. class Delegate { @@ -21,12 +21,12 @@ // Called when screen is exited. virtual void OnExit(bool success) = 0; - // This method is called, when actor is being destroyed. Note, if Delegate - // is destroyed earlier then it has to call SetDelegate(NULL). - virtual void OnActorDestroyed(EnableDebuggingScreenActor* actor) = 0; + // This method is called, when view is being destroyed. Note, if Delegate + // is destroyed earlier then it has to call SetDelegate(nullptr). + virtual void OnViewDestroyed(EnableDebuggingScreenView* view) = 0; }; - virtual ~EnableDebuggingScreenActor() {} + virtual ~EnableDebuggingScreenView() {} virtual void Show() = 0; virtual void Hide() = 0; @@ -35,4 +35,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ENABLE_DEBUGGING_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ENABLE_DEBUGGING_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/eula_screen.h b/chrome/browser/chromeos/login/screens/eula_screen.h index 4c03ebc..c7423d1 100644 --- a/chrome/browser/chromeos/login/screens/eula_screen.h +++ b/chrome/browser/chromeos/login/screens/eula_screen.h
@@ -41,7 +41,7 @@ // locale and manifest. Returns empty URL otherwise. GURL GetOemEulaUrl() const; - // Initiate TPM password fetch. Will call actor's OnPasswordFetched() when + // Initiate TPM password fetch. Will call view's OnPasswordFetched() when // done. void InitiatePasswordFetch();
diff --git a/chrome/browser/chromeos/login/screens/host_pairing_screen.cc b/chrome/browser/chromeos/login/screens/host_pairing_screen.cc index 1dbc73a..4a14f7c 100644 --- a/chrome/browser/chromeos/login/screens/host_pairing_screen.cc +++ b/chrome/browser/chromeos/login/screens/host_pairing_screen.cc
@@ -20,20 +20,20 @@ HostPairingScreen::HostPairingScreen( BaseScreenDelegate* base_screen_delegate, Delegate* delegate, - HostPairingScreenActor* actor, + HostPairingScreenView* view, pairing_chromeos::HostPairingController* remora_controller) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_HOST_PAIRING), delegate_(delegate), - actor_(actor), + view_(view), remora_controller_(remora_controller), weak_ptr_factory_(this) { - actor_->SetDelegate(this); + view_->SetDelegate(this); remora_controller_->AddObserver(this); } HostPairingScreen::~HostPairingScreen() { - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(NULL); remora_controller_->RemoveObserver(this); } @@ -42,19 +42,19 @@ return; base::DictionaryValue diff; context_.GetChangesAndReset(&diff); - if (actor_) - actor_->OnContextChanged(diff); + if (view_) + view_->OnContextChanged(diff); } void HostPairingScreen::Show() { - if (actor_) - actor_->Show(); + if (view_) + view_->Show(); PairingStageChanged(remora_controller_->GetCurrentStage()); } void HostPairingScreen::Hide() { - if (actor_) - actor_->Hide(); + if (view_) + view_->Hide(); } void HostPairingScreen::PairingStageChanged(Stage new_stage) { @@ -151,9 +151,9 @@ HostPairingController::ENROLLMENT_STATUS_ENROLLING); } -void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { - if (actor_ == actor) - actor_ = NULL; +void HostPairingScreen::OnViewDestroyed(HostPairingScreenView* view) { + if (view_ == view) + view_ = NULL; } void HostPairingScreen::OnAuthError(const GoogleServiceAuthError& error) {
diff --git a/chrome/browser/chromeos/login/screens/host_pairing_screen.h b/chrome/browser/chromeos/login/screens/host_pairing_screen.h index 87e786c..996efcc 100644 --- a/chrome/browser/chromeos/login/screens/host_pairing_screen.h +++ b/chrome/browser/chromeos/login/screens/host_pairing_screen.h
@@ -8,7 +8,7 @@ #include "base/macros.h" #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/host_pairing_screen_view.h" #include "components/login/screens/screen_context.h" #include "components/pairing/host_pairing_controller.h" @@ -17,7 +17,7 @@ class HostPairingScreen : public BaseScreen, public pairing_chromeos::HostPairingController::Observer, - public HostPairingScreenActor::Delegate, + public HostPairingScreenView::Delegate, public EnterpriseEnrollmentHelper::EnrollmentStatusConsumer { public: class Delegate { @@ -39,7 +39,7 @@ HostPairingScreen(BaseScreenDelegate* base_screen_delegate, Delegate* delegate, - HostPairingScreenActor* actor, + HostPairingScreenView* view, pairing_chromeos::HostPairingController* remora_controller); ~HostPairingScreen() override; @@ -63,7 +63,7 @@ void EnrollHostRequested(const std::string& auth_token) override; // Overridden from ControllerPairingView::Delegate: - void OnActorDestroyed(HostPairingScreenActor* actor) override; + void OnViewDestroyed(HostPairingScreenView* view) override; // Overridden from EnterpriseEnrollmentHelper::EnrollmentStatusConsumer: void OnAuthError(const GoogleServiceAuthError& error) override; @@ -79,7 +79,7 @@ Delegate* delegate_ = nullptr; - HostPairingScreenActor* actor_ = nullptr; + HostPairingScreenView* view_ = nullptr; // Controller performing pairing. Owned by the wizard controller. pairing_chromeos::HostPairingController* remora_controller_ = nullptr;
diff --git a/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.cc b/chrome/browser/chromeos/login/screens/host_pairing_screen_view.cc similarity index 91% rename from chrome/browser/chromeos/login/screens/host_pairing_screen_actor.cc rename to chrome/browser/chromeos/login/screens/host_pairing_screen_view.cc index 00b7ac4..daed366 100644 --- a/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.cc +++ b/chrome/browser/chromeos/login/screens/host_pairing_screen_view.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/host_pairing_screen_view.h" namespace chromeos { @@ -30,10 +30,8 @@ } // namespace host_pairing -HostPairingScreenActor::HostPairingScreenActor() { -} +HostPairingScreenView::HostPairingScreenView() {} -HostPairingScreenActor::~HostPairingScreenActor() { -} +HostPairingScreenView::~HostPairingScreenView() {} } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h b/chrome/browser/chromeos/login/screens/host_pairing_screen_view.h similarity index 86% rename from chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h rename to chrome/browser/chromeos/login/screens/host_pairing_screen_view.h index b6d86f8..64ded65 100644 --- a/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/host_pairing_screen_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HOST_PAIRING_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HOST_PAIRING_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HOST_PAIRING_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HOST_PAIRING_SCREEN_VIEW_H_ #include "base/macros.h" @@ -39,16 +39,16 @@ } // namespace host_pairing -class HostPairingScreenActor { +class HostPairingScreenView { public: class Delegate { public: virtual ~Delegate() {} - virtual void OnActorDestroyed(HostPairingScreenActor* actor) = 0; + virtual void OnViewDestroyed(HostPairingScreenView* view) = 0; }; - HostPairingScreenActor(); - virtual ~HostPairingScreenActor(); + HostPairingScreenView(); + virtual ~HostPairingScreenView(); virtual void Show() = 0; virtual void Hide() = 0; @@ -56,9 +56,9 @@ virtual void OnContextChanged(const base::DictionaryValue& diff) = 0; private: - DISALLOW_COPY_AND_ASSIGN(HostPairingScreenActor); + DISALLOW_COPY_AND_ASSIGN(HostPairingScreenView); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HOST_PAIRING_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HOST_PAIRING_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.cc b/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.cc index 2b78f71a..52c1f32 100644 --- a/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.cc +++ b/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.cc
@@ -13,22 +13,22 @@ KioskAutolaunchScreen::KioskAutolaunchScreen( BaseScreenDelegate* base_screen_delegate, - KioskAutolaunchScreenActor* actor) + KioskAutolaunchScreenView* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_KIOSK_AUTOLAUNCH), - actor_(actor) { - DCHECK(actor_); - if (actor_) - actor_->SetDelegate(this); + view_(view) { + DCHECK(view_); + if (view_) + view_->SetDelegate(this); } KioskAutolaunchScreen::~KioskAutolaunchScreen() { - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(NULL); } void KioskAutolaunchScreen::Show() { - if (actor_) - actor_->Show(); + if (view_) + view_->Show(); } void KioskAutolaunchScreen::OnExit(bool confirmed) { @@ -36,10 +36,9 @@ : BaseScreenDelegate::KIOSK_AUTOLAUNCH_CANCELED); } -void KioskAutolaunchScreen::OnActorDestroyed( - KioskAutolaunchScreenActor* actor) { - if (actor_ == actor) - actor_ = NULL; +void KioskAutolaunchScreen::OnViewDestroyed(KioskAutolaunchScreenView* view) { + if (view_ == view) + view_ = NULL; } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h b/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h index 5a22e59..bcba0aa6 100644 --- a/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h +++ b/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h
@@ -10,17 +10,17 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_view.h" namespace chromeos { // Representation independent class that controls screen showing auto launch // warning to users. class KioskAutolaunchScreen : public BaseScreen, - public KioskAutolaunchScreenActor::Delegate { + public KioskAutolaunchScreenView::Delegate { public: KioskAutolaunchScreen(BaseScreenDelegate* base_screen_delegate, - KioskAutolaunchScreenActor* actor); + KioskAutolaunchScreenView* view); ~KioskAutolaunchScreen() override; // BaseScreen implementation: @@ -29,10 +29,10 @@ // KioskAutolaunchScreenActor::Delegate implementation: void OnExit(bool confirmed) override; - void OnActorDestroyed(KioskAutolaunchScreenActor* actor) override; + void OnViewDestroyed(KioskAutolaunchScreenView* view) override; private: - KioskAutolaunchScreenActor* actor_; + KioskAutolaunchScreenView* view_; DISALLOW_COPY_AND_ASSIGN(KioskAutolaunchScreen); };
diff --git a/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_actor.h b/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_view.h similarity index 65% rename from chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_actor.h rename to chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_view.h index 7a70760..c45487d 100644 --- a/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_view.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_AUTOLAUNCH_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_AUTOLAUNCH_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_AUTOLAUNCH_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_AUTOLAUNCH_SCREEN_VIEW_H_ #include <string> namespace chromeos { // Interface between reset screen and its representation. -// Note, do not forget to call OnActorDestroyed in the dtor. -class KioskAutolaunchScreenActor { +// Note, do not forget to call OnViewDestroyed in the dtor. +class KioskAutolaunchScreenView { public: // Allows us to get info from reset screen that we need. class Delegate { @@ -21,12 +21,12 @@ // Called when screen is exited. virtual void OnExit(bool confirmed) = 0; - // This method is called, when actor is being destroyed. Note, if Delegate - // is destroyed earlier then it has to call SetDelegate(NULL). - virtual void OnActorDestroyed(KioskAutolaunchScreenActor* actor) = 0; + // This method is called, when view is being destroyed. Note, if Delegate + // is destroyed earlier then it has to call SetDelegate(nullptr). + virtual void OnViewDestroyed(KioskAutolaunchScreenView* view) = 0; }; - virtual ~KioskAutolaunchScreenActor() {} + virtual ~KioskAutolaunchScreenView() {} virtual void Show() = 0; virtual void SetDelegate(Delegate* delegate) = 0; @@ -34,4 +34,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_AUTOLAUNCH_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_AUTOLAUNCH_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/kiosk_enable_screen.cc b/chrome/browser/chromeos/login/screens/kiosk_enable_screen.cc index 0b6c965..f6434ab8 100644 --- a/chrome/browser/chromeos/login/screens/kiosk_enable_screen.cc +++ b/chrome/browser/chromeos/login/screens/kiosk_enable_screen.cc
@@ -12,31 +12,31 @@ namespace chromeos { KioskEnableScreen::KioskEnableScreen(BaseScreenDelegate* base_screen_delegate, - KioskEnableScreenActor* actor) + KioskEnableScreenView* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_KIOSK_ENABLE), - actor_(actor) { - DCHECK(actor_); - if (actor_) - actor_->SetDelegate(this); + view_(view) { + DCHECK(view_); + if (view_) + view_->SetDelegate(this); } KioskEnableScreen::~KioskEnableScreen() { - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(NULL); } void KioskEnableScreen::Show() { - if (actor_) - actor_->Show(); + if (view_) + view_->Show(); } void KioskEnableScreen::OnExit() { Finish(BaseScreenDelegate::KIOSK_ENABLE_COMPLETED); } -void KioskEnableScreen::OnActorDestroyed(KioskEnableScreenActor* actor) { - if (actor_ == actor) - actor_ = NULL; +void KioskEnableScreen::OnViewDestroyed(KioskEnableScreenView* view) { + if (view_ == view) + view_ = NULL; } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/kiosk_enable_screen.h b/chrome/browser/chromeos/login/screens/kiosk_enable_screen.h index e5edae3..f2b101cf 100644 --- a/chrome/browser/chromeos/login/screens/kiosk_enable_screen.h +++ b/chrome/browser/chromeos/login/screens/kiosk_enable_screen.h
@@ -10,17 +10,17 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/screens/kiosk_enable_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h" namespace chromeos { // Representation independent class that controls screen for enabling // consumer kiosk mode. class KioskEnableScreen : public BaseScreen, - public KioskEnableScreenActor::Delegate { + public KioskEnableScreenView::Delegate { public: KioskEnableScreen(BaseScreenDelegate* base_screen_delegate, - KioskEnableScreenActor* actor); + KioskEnableScreenView* view); ~KioskEnableScreen() override; // BaseScreen implementation: @@ -29,10 +29,10 @@ // KioskEnableScreenActor::Delegate implementation: void OnExit() override; - void OnActorDestroyed(KioskEnableScreenActor* actor) override; + void OnViewDestroyed(KioskEnableScreenView* view) override; private: - KioskEnableScreenActor* actor_; + KioskEnableScreenView* view_; DISALLOW_COPY_AND_ASSIGN(KioskEnableScreen); };
diff --git a/chrome/browser/chromeos/login/screens/kiosk_enable_screen_actor.h b/chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h similarity index 66% rename from chrome/browser/chromeos/login/screens/kiosk_enable_screen_actor.h rename to chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h index 727d1e38..f4304dd 100644 --- a/chrome/browser/chromeos/login/screens/kiosk_enable_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_VIEW_H_ #include <string> namespace chromeos { // Interface between enable kiosk screen and its representation. -// Note, do not forget to call OnActorDestroyed in the dtor. -class KioskEnableScreenActor { +// Note, do not forget to call OnViewDestroyed in the dtor. +class KioskEnableScreenView { public: // Allows us to get info from reset screen that we need. class Delegate { @@ -21,12 +21,12 @@ // Called when screen is exited. virtual void OnExit() = 0; - // This method is called, when actor is being destroyed. Note, if Delegate - // is destroyed earlier then it has to call SetDelegate(NULL). - virtual void OnActorDestroyed(KioskEnableScreenActor* actor) = 0; + // This method is called, when view is being destroyed. Note, if Delegate + // is destroyed earlier then it has to call SetDelegate(nullptr). + virtual void OnViewDestroyed(KioskEnableScreenView* view) = 0; }; - virtual ~KioskEnableScreenActor() {} + virtual ~KioskEnableScreenView() {} virtual void Show() = 0; virtual void SetDelegate(Delegate* delegate) = 0; @@ -34,4 +34,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/mock_device_disabled_screen_actor.cc b/chrome/browser/chromeos/login/screens/mock_device_disabled_screen_view.cc similarity index 69% rename from chrome/browser/chromeos/login/screens/mock_device_disabled_screen_actor.cc rename to chrome/browser/chromeos/login/screens/mock_device_disabled_screen_view.cc index f852b948..118334b 100644 --- a/chrome/browser/chromeos/login/screens/mock_device_disabled_screen_actor.cc +++ b/chrome/browser/chromeos/login/screens/mock_device_disabled_screen_view.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/login/screens/mock_device_disabled_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/mock_device_disabled_screen_view.h" using ::testing::AtLeast; using ::testing::AtMost; @@ -10,18 +10,18 @@ namespace chromeos { -MockDeviceDisabledScreenActor::MockDeviceDisabledScreenActor() +MockDeviceDisabledScreenView::MockDeviceDisabledScreenView() : delegate_(nullptr) { EXPECT_CALL(*this, MockSetDelegate(NotNull())).Times(AtLeast(1)); EXPECT_CALL(*this, MockSetDelegate(nullptr)).Times(AtMost(1)); } -MockDeviceDisabledScreenActor::~MockDeviceDisabledScreenActor() { +MockDeviceDisabledScreenView::~MockDeviceDisabledScreenView() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } -void MockDeviceDisabledScreenActor::SetDelegate(Delegate* delegate) { +void MockDeviceDisabledScreenView::SetDelegate(Delegate* delegate) { delegate_ = delegate; MockSetDelegate(delegate); }
diff --git a/chrome/browser/chromeos/login/screens/mock_device_disabled_screen_actor.h b/chrome/browser/chromeos/login/screens/mock_device_disabled_screen_view.h similarity index 77% rename from chrome/browser/chromeos/login/screens/mock_device_disabled_screen_actor.h rename to chrome/browser/chromeos/login/screens/mock_device_disabled_screen_view.h index e124e06..50c73180 100644 --- a/chrome/browser/chromeos/login/screens/mock_device_disabled_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/mock_device_disabled_screen_view.h
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_DEVICE_DISABLED_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_DEVICE_DISABLED_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_DEVICE_DISABLED_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_DEVICE_DISABLED_SCREEN_VIEW_H_ -#include "chrome/browser/chromeos/login/screens/device_disabled_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/device_disabled_screen_view.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { -class MockDeviceDisabledScreenActor : public DeviceDisabledScreenActor { +class MockDeviceDisabledScreenView : public DeviceDisabledScreenView { public: - MockDeviceDisabledScreenActor(); - ~MockDeviceDisabledScreenActor() override; + MockDeviceDisabledScreenView(); + ~MockDeviceDisabledScreenView() override; void SetDelegate(Delegate* delegate) override; @@ -29,4 +29,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_DEVICE_DISABLED_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_DEVICE_DISABLED_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.cc b/chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.cc index a6a5ad4..179d550 100644 --- a/chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.cc +++ b/chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.cc
@@ -11,24 +11,23 @@ MockEnableDebuggingScreen::MockEnableDebuggingScreen( BaseScreenDelegate* base_screen_delegate, - EnableDebuggingScreenActor* actor) - : EnableDebuggingScreen(base_screen_delegate, actor) { -} + EnableDebuggingScreenView* view) + : EnableDebuggingScreen(base_screen_delegate, view) {} MockEnableDebuggingScreen::~MockEnableDebuggingScreen() { } -MockEnableDebuggingScreenActor::MockEnableDebuggingScreenActor() { +MockEnableDebuggingScreenView::MockEnableDebuggingScreenView() { EXPECT_CALL(*this, MockSetDelegate(NotNull())).Times(AtLeast(1)); } -MockEnableDebuggingScreenActor::~MockEnableDebuggingScreenActor() { +MockEnableDebuggingScreenView::~MockEnableDebuggingScreenView() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } -void MockEnableDebuggingScreenActor::SetDelegate( - EnableDebuggingScreenActor::Delegate* delegate) { +void MockEnableDebuggingScreenView::SetDelegate( + EnableDebuggingScreenView::Delegate* delegate) { delegate_ = delegate; MockSetDelegate(delegate); }
diff --git a/chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.h b/chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.h index 27076dc..862b59a 100644 --- a/chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.h +++ b/chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.h
@@ -6,7 +6,7 @@ #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_ENABLE_DEBUGGING_SCREEN_H_ #include "chrome/browser/chromeos/login/screens/enable_debugging_screen.h" -#include "chrome/browser/chromeos/login/screens/enable_debugging_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/enable_debugging_screen_view.h" #include "google_apis/gaia/google_service_auth_error.h" #include "testing/gmock/include/gmock/gmock.h" @@ -15,21 +15,20 @@ class MockEnableDebuggingScreen : public EnableDebuggingScreen { public: MockEnableDebuggingScreen(BaseScreenDelegate* base_screen_delegate, - EnableDebuggingScreenActor* actor); + EnableDebuggingScreenView* view); ~MockEnableDebuggingScreen() override; }; -class MockEnableDebuggingScreenActor - : public EnableDebuggingScreenActor { +class MockEnableDebuggingScreenView : public EnableDebuggingScreenView { public: - MockEnableDebuggingScreenActor(); - ~MockEnableDebuggingScreenActor() override; + MockEnableDebuggingScreenView(); + ~MockEnableDebuggingScreenView() override; MOCK_METHOD0(Show, void()); MOCK_METHOD0(Hide, void()); MOCK_METHOD1(MockSetDelegate, void(Delegate* delegate)); - void SetDelegate(EnableDebuggingScreenActor::Delegate* delegate) override; + void SetDelegate(EnableDebuggingScreenView::Delegate* delegate) override; private: Delegate* delegate_;
diff --git a/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.cc b/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.cc index 7a2c938..1982bf5 100644 --- a/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.cc +++ b/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.cc
@@ -11,23 +11,22 @@ MockWrongHWIDScreen::MockWrongHWIDScreen( BaseScreenDelegate* base_screen_delegate, - WrongHWIDScreenActor* actor) - : WrongHWIDScreen(base_screen_delegate, actor) { -} + WrongHWIDScreenView* view) + : WrongHWIDScreen(base_screen_delegate, view) {} MockWrongHWIDScreen::~MockWrongHWIDScreen() { } -MockWrongHWIDScreenActor::MockWrongHWIDScreenActor() : delegate_(nullptr) { +MockWrongHWIDScreenView::MockWrongHWIDScreenView() : delegate_(nullptr) { EXPECT_CALL(*this, MockSetDelegate(NotNull())).Times(AtLeast(1)); } -MockWrongHWIDScreenActor::~MockWrongHWIDScreenActor() { +MockWrongHWIDScreenView::~MockWrongHWIDScreenView() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } -void MockWrongHWIDScreenActor::SetDelegate(Delegate* delegate) { +void MockWrongHWIDScreenView::SetDelegate(Delegate* delegate) { delegate_ = delegate; MockSetDelegate(delegate); }
diff --git a/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h b/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h index dfa180f..66dd49c 100644 --- a/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h +++ b/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h
@@ -6,7 +6,7 @@ #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_WRONG_HWID_SCREEN_H_ #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h" -#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { @@ -16,14 +16,14 @@ class MockWrongHWIDScreen : public WrongHWIDScreen { public: MockWrongHWIDScreen(BaseScreenDelegate* base_screen_delegate, - WrongHWIDScreenActor* actor); + WrongHWIDScreenView* view); ~MockWrongHWIDScreen() override; }; -class MockWrongHWIDScreenActor : public WrongHWIDScreenActor { +class MockWrongHWIDScreenView : public WrongHWIDScreenView { public: - MockWrongHWIDScreenActor(); - ~MockWrongHWIDScreenActor() override; + MockWrongHWIDScreenView(); + ~MockWrongHWIDScreenView() override; void SetDelegate(Delegate* delegate) override;
diff --git a/chrome/browser/chromeos/login/screens/network_screen_browsertest.cc b/chrome/browser/chromeos/login/screens/network_screen_browsertest.cc index 163cc7d..3d5ea73e0 100644 --- a/chrome/browser/chromeos/login/screens/network_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/screens/network_screen_browsertest.cc
@@ -121,39 +121,39 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, CanConnect) { EXPECT_CALL(*mock_network_state_helper_, IsConnecting()) .WillOnce((Return(true))); - // EXPECT_FALSE(actor_->IsContinueEnabled()); + // EXPECT_FALSE(view_->IsContinueEnabled()); network_screen_->UpdateStatus(); EXPECT_CALL(*mock_network_state_helper_, IsConnected()) .Times(2) .WillRepeatedly(Return(true)); - // TODO(nkostylev): Add integration with WebUI actor http://crosbug.com/22570 - // EXPECT_FALSE(actor_->IsContinueEnabled()); - // EXPECT_FALSE(actor_->IsConnecting()); + // TODO(nkostylev): Add integration with WebUI view http://crosbug.com/22570 + // EXPECT_FALSE(view_->IsContinueEnabled()); + // EXPECT_FALSE(view_->IsConnecting()); network_screen_->UpdateStatus(); - // EXPECT_TRUE(actor_->IsContinueEnabled()); + // EXPECT_TRUE(view_->IsContinueEnabled()); EmulateContinueButtonExit(network_screen_); } IN_PROC_BROWSER_TEST_F(NetworkScreenTest, Timeout) { EXPECT_CALL(*mock_network_state_helper_, IsConnecting()) .WillOnce((Return(true))); - // EXPECT_FALSE(actor_->IsContinueEnabled()); + // EXPECT_FALSE(view_->IsContinueEnabled()); network_screen_->UpdateStatus(); EXPECT_CALL(*mock_network_state_helper_, IsConnected()) .Times(2) .WillRepeatedly(Return(false)); - // TODO(nkostylev): Add integration with WebUI actor http://crosbug.com/22570 - // EXPECT_FALSE(actor_->IsContinueEnabled()); - // EXPECT_FALSE(actor_->IsConnecting()); + // TODO(nkostylev): Add integration with WebUI view http://crosbug.com/22570 + // EXPECT_FALSE(view_->IsContinueEnabled()); + // EXPECT_FALSE(view_->IsConnecting()); network_screen_->OnConnectionTimeout(); // Close infobubble with error message - it makes the test stable. - // EXPECT_FALSE(actor_->IsContinueEnabled()); - // EXPECT_FALSE(actor_->IsConnecting()); - // actor_->ClearErrors(); + // EXPECT_FALSE(view_->IsContinueEnabled()); + // EXPECT_FALSE(view_->IsConnecting()); + // view_->ClearErrors(); } class HandsOffNetworkScreenTest : public NetworkScreenTest {
diff --git a/chrome/browser/chromeos/login/screens/reset_screen.h b/chrome/browser/chromeos/login/screens/reset_screen.h index 77740e6..e54b0aa 100644 --- a/chrome/browser/chromeos/login/screens/reset_screen.h +++ b/chrome/browser/chromeos/login/screens/reset_screen.h
@@ -28,7 +28,7 @@ ResetView* view); ~ResetScreen() override; - // Called when actor is destroyed so there's no dead reference to it. + // Called when view is destroyed so there's no dead reference to it. void OnViewDestroyed(ResetView* view); private:
diff --git a/chrome/browser/chromeos/login/screens/terms_of_service_screen.cc b/chrome/browser/chromeos/login/screens/terms_of_service_screen.cc index ffbebd1..15d3eee 100644 --- a/chrome/browser/chromeos/login/screens/terms_of_service_screen.cc +++ b/chrome/browser/chromeos/login/screens/terms_of_service_screen.cc
@@ -28,38 +28,38 @@ TermsOfServiceScreen::TermsOfServiceScreen( BaseScreenDelegate* base_screen_delegate, - TermsOfServiceScreenActor* actor) + TermsOfServiceScreenView* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_TERMS_OF_SERVICE), - actor_(actor) { - DCHECK(actor_); - if (actor_) - actor_->SetDelegate(this); + view_(view) { + DCHECK(view_); + if (view_) + view_->SetDelegate(this); } TermsOfServiceScreen::~TermsOfServiceScreen() { - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(NULL); } void TermsOfServiceScreen::Show() { - if (!actor_) + if (!view_) return; // Set the domain name whose Terms of Service are being shown. policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); - actor_->SetDomain(connector->GetEnterpriseDomain()); + view_->SetDomain(connector->GetEnterpriseDomain()); // Show the screen. - actor_->Show(); + view_->Show(); // Start downloading the Terms of Service. StartDownload(); } void TermsOfServiceScreen::Hide() { - if (actor_) - actor_->Hide(); + if (view_) + view_->Hide(); } void TermsOfServiceScreen::OnDecline() { @@ -70,9 +70,9 @@ Finish(BaseScreenDelegate::TERMS_OF_SERVICE_ACCEPTED); } -void TermsOfServiceScreen::OnActorDestroyed(TermsOfServiceScreenActor* actor) { - if (actor_ == actor) - actor_ = NULL; +void TermsOfServiceScreen::OnViewDestroyed(TermsOfServiceScreenView* view) { + if (view_ == view) + view_ = NULL; } void TermsOfServiceScreen::StartDownload() { @@ -82,8 +82,8 @@ std::string terms_of_service_url = prefs->GetString(prefs::kTermsOfServiceURL); if (terms_of_service_url.empty()) { - if (actor_) - actor_->OnLoadError(); + if (view_) + view_->OnLoadError(); return; } @@ -110,8 +110,8 @@ terms_of_service_fetcher_.reset(); // Show an error message to the user. - if (actor_) - actor_->OnLoadError(); + if (view_) + view_->OnLoadError(); } void TermsOfServiceScreen::OnURLFetchComplete(const net::URLFetcher* source) { @@ -125,7 +125,7 @@ // Destroy the fetcher when this method returns. std::unique_ptr<net::URLFetcher> fetcher( std::move(terms_of_service_fetcher_)); - if (!actor_) + if (!view_) return; std::string terms_of_service; @@ -136,11 +136,11 @@ !source->GetResponseHeaders()->GetMimeType(&mime_type) || mime_type != "text/plain" || !source->GetResponseAsString(&terms_of_service)) { - actor_->OnLoadError(); + view_->OnLoadError(); } else { // If the Terms of Service were downloaded successfully, show them to the // user. - actor_->OnLoadSuccess(terms_of_service); + view_->OnLoadSuccess(terms_of_service); } }
diff --git a/chrome/browser/chromeos/login/screens/terms_of_service_screen.h b/chrome/browser/chromeos/login/screens/terms_of_service_screen.h index d4fff4da..7d6ac22 100644 --- a/chrome/browser/chromeos/login/screens/terms_of_service_screen.h +++ b/chrome/browser/chromeos/login/screens/terms_of_service_screen.h
@@ -11,7 +11,7 @@ #include "base/macros.h" #include "base/timer/timer.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/terms_of_service_screen_view.h" #include "net/url_request/url_fetcher_delegate.h" namespace net { @@ -27,11 +27,11 @@ // Terms of Service before proceeding. Currently, Terms of Service are available // for public sessions only. class TermsOfServiceScreen : public BaseScreen, - public TermsOfServiceScreenActor::Delegate, + public TermsOfServiceScreenView::Delegate, public net::URLFetcherDelegate { public: TermsOfServiceScreen(BaseScreenDelegate* base_screen_delegate, - TermsOfServiceScreenActor* actor); + TermsOfServiceScreenView* view); ~TermsOfServiceScreen() override; // BaseScreen: @@ -41,7 +41,7 @@ // TermsOfServiceScreenActor::Delegate: void OnDecline() override; void OnAccept() override; - void OnActorDestroyed(TermsOfServiceScreenActor* actor) override; + void OnViewDestroyed(TermsOfServiceScreenView* view) override; private: // Start downloading the Terms of Service. @@ -53,7 +53,7 @@ // net::URLFetcherDelegate: void OnURLFetchComplete(const net::URLFetcher* source) override; - TermsOfServiceScreenActor* actor_; + TermsOfServiceScreenView* view_; std::unique_ptr<net::URLFetcher> terms_of_service_fetcher_;
diff --git a/chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h b/chrome/browser/chromeos/login/screens/terms_of_service_screen_view.h similarity index 81% rename from chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h rename to chrome/browser/chromeos/login/screens/terms_of_service_screen_view.h index b52b3268..dcd3ee4 100644 --- a/chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/terms_of_service_screen_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_VIEW_H_ #include <string> @@ -11,7 +11,7 @@ // Interface for dependency injection between TermsOfServiceScreen and its // WebUI representation. -class TermsOfServiceScreenActor { +class TermsOfServiceScreenView { public: class Delegate { public: @@ -23,13 +23,13 @@ // Called when the user accepts the Terms of Service. virtual void OnAccept() = 0; - // Called when actor is destroyed so there is no dead reference to it. - virtual void OnActorDestroyed(TermsOfServiceScreenActor* actor) = 0; + // Called when view is destroyed so there is no dead reference to it. + virtual void OnViewDestroyed(TermsOfServiceScreenView* view) = 0; }; - virtual ~TermsOfServiceScreenActor() {} + virtual ~TermsOfServiceScreenView() {} - // Sets screen this actor belongs to. + // Sets screen this view belongs to. virtual void SetDelegate(Delegate* screen) = 0; // Shows the contents of the screen. @@ -52,4 +52,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/wrong_hwid_screen.cc b/chrome/browser/chromeos/login/screens/wrong_hwid_screen.cc index e073d02c..8b85357b 100644 --- a/chrome/browser/chromeos/login/screens/wrong_hwid_screen.cc +++ b/chrome/browser/chromeos/login/screens/wrong_hwid_screen.cc
@@ -10,36 +10,36 @@ namespace chromeos { WrongHWIDScreen::WrongHWIDScreen(BaseScreenDelegate* base_screen_delegate, - WrongHWIDScreenActor* actor) + WrongHWIDScreenView* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_WRONG_HWID), - actor_(actor) { - DCHECK(actor_); - if (actor_) - actor_->SetDelegate(this); + view_(view) { + DCHECK(view_); + if (view_) + view_->SetDelegate(this); } WrongHWIDScreen::~WrongHWIDScreen() { - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(nullptr); } void WrongHWIDScreen::Show() { - if (actor_) - actor_->Show(); + if (view_) + view_->Show(); } void WrongHWIDScreen::Hide() { - if (actor_) - actor_->Hide(); + if (view_) + view_->Hide(); } void WrongHWIDScreen::OnExit() { Finish(BaseScreenDelegate::WRONG_HWID_WARNING_SKIPPED); } -void WrongHWIDScreen::OnActorDestroyed(WrongHWIDScreenActor* actor) { - if (actor_ == actor) - actor_ = NULL; +void WrongHWIDScreen::OnViewDestroyed(WrongHWIDScreenView* view) { + if (view_ == view) + view_ = nullptr; } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/wrong_hwid_screen.h b/chrome/browser/chromeos/login/screens/wrong_hwid_screen.h index ae1fe959..84374036 100644 --- a/chrome/browser/chromeos/login/screens/wrong_hwid_screen.h +++ b/chrome/browser/chromeos/login/screens/wrong_hwid_screen.h
@@ -10,29 +10,29 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h" namespace chromeos { // Representation independent class that controls screen showing warning about // malformed HWID to users. class WrongHWIDScreen : public BaseScreen, - public WrongHWIDScreenActor::Delegate { + public WrongHWIDScreenView::Delegate { public: WrongHWIDScreen(BaseScreenDelegate* base_screen_delegate, - WrongHWIDScreenActor* actor); + WrongHWIDScreenView* view); ~WrongHWIDScreen() override; // BaseScreen implementation: void Show() override; void Hide() override; - // WrongHWIDScreenActor::Delegate implementation: + // WrongHWIDScreenView::Delegate implementation: void OnExit() override; - void OnActorDestroyed(WrongHWIDScreenActor* actor) override; + void OnViewDestroyed(WrongHWIDScreenView* view) override; private: - WrongHWIDScreenActor* actor_; + WrongHWIDScreenView* view_; DISALLOW_COPY_AND_ASSIGN(WrongHWIDScreen); };
diff --git a/chrome/browser/chromeos/login/screens/wrong_hwid_screen_actor.h b/chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h similarity index 74% rename from chrome/browser/chromeos/login/screens/wrong_hwid_screen_actor.h rename to chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h index fa9faac1..9576e66c 100644 --- a/chrome/browser/chromeos/login/screens/wrong_hwid_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_ACTOR_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_ACTOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_VIEW_H_ #include <string> namespace chromeos { // Interface between wrong HWID screen and its representation. -// Note, do not forget to call OnActorDestroyed in the dtor. -class WrongHWIDScreenActor { +// Note, do not forget to call OnViewDestroyed in the dtor. +class WrongHWIDScreenView { public: // Allows us to get info from wrong HWID screen that we need. class Delegate { @@ -21,12 +21,12 @@ // Called when screen is exited. virtual void OnExit() = 0; - // This method is called, when actor is being destroyed. Note, if Delegate + // This method is called, when view is being destroyed. Note, if Delegate // is destroyed earlier then it has to call SetDelegate(NULL). - virtual void OnActorDestroyed(WrongHWIDScreenActor* actor) = 0; + virtual void OnViewDestroyed(WrongHWIDScreenView* view) = 0; }; - virtual ~WrongHWIDScreenActor() {} + virtual ~WrongHWIDScreenView() {} virtual void Show() = 0; virtual void Hide() = 0; @@ -35,5 +35,4 @@ } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_ACTOR_H_ - +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.h b/chrome/browser/chromeos/login/session/user_session_manager.h index 604dd3e..cc1090a 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager.h +++ b/chrome/browser/chromeos/login/session/user_session_manager.h
@@ -506,8 +506,7 @@ // Child account status is necessary for InitializeStartUrls call. bool waiting_for_child_account_status_; - scoped_refptr<typename HatsNotificationController::HatsNotificationController> - hats_notification_controller_; + scoped_refptr<HatsNotificationController> hats_notification_controller_; base::WeakPtrFactory<UserSessionManager> weak_factory_;
diff --git a/chrome/browser/chromeos/login/signin_screen_controller.cc b/chrome/browser/chromeos/login/signin_screen_controller.cc index e877048..f3a37e9 100644 --- a/chrome/browser/chromeos/login/signin_screen_controller.cc +++ b/chrome/browser/chromeos/login/signin_screen_controller.cc
@@ -23,12 +23,12 @@ DCHECK(!instance_); instance_ = this; - gaia_screen_->SetScreenHandler(oobe_ui_->GetGaiaScreenActor()); + gaia_screen_->SetScreenHandler(oobe_ui_->GetGaiaScreenView()); std::string display_type = oobe_ui->display_type(); user_selection_screen_.reset(new ChromeUserSelectionScreen(display_type)); user_selection_screen_->SetLoginDisplayDelegate(login_display_delegate); - user_board_view_ = oobe_ui_->GetUserBoardScreenActor()->GetWeakPtr(); + user_board_view_ = oobe_ui_->GetUserBoardView()->GetWeakPtr(); user_selection_screen_->SetView(user_board_view_.get()); // TODO(jdufault): Bind and Unbind should be controlled by either the // Model/View which are then each responsible for automatically unbinding the
diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc index 0292ad6..5ef2acb 100644 --- a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc +++ b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc
@@ -102,10 +102,10 @@ SupervisedUserCreationScreen::SupervisedUserCreationScreen( BaseScreenDelegate* base_screen_delegate, - SupervisedUserCreationScreenHandler* actor) + SupervisedUserCreationScreenHandler* view) : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW), - actor_(actor), + view_(view), on_error_screen_(false), manager_signin_in_progress_(false), last_page_(kNameOfIntroScreen), @@ -114,30 +114,30 @@ selected_image_(0), histogram_helper_(new ErrorScreensHistogramHelper("Supervised")), weak_factory_(this) { - DCHECK(actor_); - if (actor_) - actor_->SetDelegate(this); + DCHECK(view_); + if (view_) + view_->SetDelegate(this); } SupervisedUserCreationScreen::~SupervisedUserCreationScreen() { CameraPresenceNotifier::GetInstance()->RemoveObserver(this); if (sync_service_) sync_service_->RemoveObserver(this); - if (actor_) - actor_->SetDelegate(NULL); + if (view_) + view_->SetDelegate(NULL); network_portal_detector::GetInstance()->RemoveObserver(this); } void SupervisedUserCreationScreen::Show() { CameraPresenceNotifier::GetInstance()->AddObserver(this); - if (actor_) { - actor_->Show(); + if (view_) { + view_->Show(); // TODO(antrim) : temorary hack (until upcoming hackaton). Should be // removed once we have screens reworked. if (on_error_screen_) - actor_->ShowPage(last_page_); + view_->ShowPage(last_page_); else - actor_->ShowIntroPage(); + view_->ShowIntroPage(); } if (!on_error_screen_) @@ -169,9 +169,9 @@ void SupervisedUserCreationScreen::ShowManagerInconsistentStateErrorScreen() { manager_signin_in_progress_ = false; - if (!actor_) + if (!view_) return; - actor_->ShowErrorPage( + view_->ShowErrorPage( l10n_util::GetStringUTF16( IDS_CREATE_SUPERVISED_USER_MANAGER_INCONSISTENT_STATE_TITLE), l10n_util::GetStringUTF16( @@ -181,14 +181,14 @@ } void SupervisedUserCreationScreen::ShowInitialScreen() { - if (actor_) - actor_->ShowIntroPage(); + if (view_) + view_->ShowIntroPage(); } void SupervisedUserCreationScreen::Hide() { CameraPresenceNotifier::GetInstance()->RemoveObserver(this); - if (actor_) - actor_->Hide(); + if (view_) + view_->Hide(); if (!on_error_screen_) network_portal_detector::GetInstance()->RemoveObserver(this); } @@ -273,11 +273,10 @@ // We should not get here with existing user selected, so just display error. if (exists) { - actor_->ShowErrorPage( + view_->ShowErrorPage( l10n_util::GetStringUTF16( IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_TITLE), - l10n_util::GetStringUTF16( - IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR), + l10n_util::GetStringUTF16(IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR), l10n_util::GetStringUTF16( IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_BUTTON)); return; @@ -333,11 +332,10 @@ // We should not get here with existing user selected, so just display error. if (exists) { - actor_->ShowErrorPage( + view_->ShowErrorPage( l10n_util::GetStringUTF16( IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_TITLE), - l10n_util::GetStringUTF16( - IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR), + l10n_util::GetStringUTF16(IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR), l10n_util::GetStringUTF16( IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_BUTTON)); return; @@ -354,8 +352,8 @@ void SupervisedUserCreationScreen::OnManagerLoginFailure() { manager_signin_in_progress_ = false; - if (actor_) - actor_->ShowManagerPasswordError(); + if (view_) + view_->ShowManagerPasswordError(); } void SupervisedUserCreationScreen::OnManagerFullyAuthenticated( @@ -370,8 +368,8 @@ ash::WmShell::Get()->wallpaper_controller()->MoveToLockedContainer(); controller_->SetManagerProfile(manager_profile); - if (actor_) - actor_->ShowUsernamePage(); + if (view_) + view_->ShowUsernamePage(); last_page_ = kNameOfNewUserParametersScreen; CHECK(!sync_service_); @@ -389,16 +387,18 @@ } void SupervisedUserCreationScreen::OnManagerCryptohomeAuthenticated() { - if (actor_) { - actor_->ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( - IDS_CREATE_SUPERVISED_USER_CREATION_AUTH_PROGRESS_MESSAGE)); + if (view_) { + view_->ShowStatusMessage( + true /* progress */, + l10n_util::GetStringUTF16( + IDS_CREATE_SUPERVISED_USER_CREATION_AUTH_PROGRESS_MESSAGE)); } } -void SupervisedUserCreationScreen::OnActorDestroyed( - SupervisedUserCreationScreenHandler* actor) { - if (actor_ == actor) - actor_ = NULL; +void SupervisedUserCreationScreen::OnViewDestroyed( + SupervisedUserCreationScreenHandler* view) { + if (view_ == view) + view_ = NULL; } void SupervisedUserCreationScreen::OnCreationError( @@ -433,21 +433,25 @@ case SupervisedUserCreationController::NO_ERROR: NOTREACHED(); } - if (actor_) - actor_->ShowErrorPage(title, message, button); + if (view_) + view_->ShowErrorPage(title, message, button); } void SupervisedUserCreationScreen::OnCreationTimeout() { - if (actor_) { - actor_->ShowStatusMessage(false /* error */, l10n_util::GetStringUTF16( - IDS_CREATE_SUPERVISED_USER_CREATION_CREATION_TIMEOUT_MESSAGE)); + if (view_) { + view_->ShowStatusMessage( + false /* error */, + l10n_util::GetStringUTF16( + IDS_CREATE_SUPERVISED_USER_CREATION_CREATION_TIMEOUT_MESSAGE)); } } void SupervisedUserCreationScreen::OnLongCreationWarning() { - if (actor_) { - actor_->ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( - IDS_PROFILES_CREATE_SUPERVISED_JUST_SIGNED_IN)); + if (view_) { + view_->ShowStatusMessage( + true /* progress */, + l10n_util::GetStringUTF16( + IDS_PROFILES_CREATE_SUPERVISED_JUST_SIGNED_IN)); } } @@ -501,7 +505,7 @@ break; } // Proceed to tutorial. - actor_->ShowTutorialPage(); + view_->ShowTutorialPage(); } void SupervisedUserCreationScreen::OnCreationSuccess() { @@ -510,8 +514,8 @@ void SupervisedUserCreationScreen::OnCameraPresenceCheckDone( bool is_camera_present) { - if (actor_) - actor_->SetCameraPresent(is_camera_present); + if (view_) + view_->SetCameraPresent(is_camera_present); } void SupervisedUserCreationScreen::OnGetSupervisedUsers( @@ -583,7 +587,7 @@ existing_users_->Set(it.key(), local_copy); ui_users->Append(std::move(ui_copy)); } - actor_->ShowExistingSupervisedUsers(ui_users.get()); + view_->ShowExistingSupervisedUsers(ui_users.get()); } void SupervisedUserCreationScreen::OnPhotoTaken(
diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.h b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.h index cc79735..018f924 100644 --- a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.h +++ b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.h
@@ -37,7 +37,7 @@ public CameraPresenceNotifier::Observer { public: SupervisedUserCreationScreen(BaseScreenDelegate* base_screen_delegate, - SupervisedUserCreationScreenHandler* actor); + SupervisedUserCreationScreenHandler* view); ~SupervisedUserCreationScreen() override; static SupervisedUserCreationScreen* Get(ScreenManager* manager); @@ -79,7 +79,7 @@ void Hide() override; // SupervisedUserCreationScreenHandler::Delegate implementation: - void OnActorDestroyed(SupervisedUserCreationScreenHandler* actor) override; + void OnViewDestroyed(SupervisedUserCreationScreenHandler* view) override; void CreateSupervisedUser( const base::string16& display_name, const std::string& supervised_user_password) override; @@ -123,7 +123,7 @@ void ApplyPicture(); void OnGetSupervisedUsers(const base::DictionaryValue* users); - SupervisedUserCreationScreenHandler* actor_; + SupervisedUserCreationScreenHandler* view_; std::unique_ptr<SupervisedUserCreationController> controller_; std::unique_ptr<base::DictionaryValue> existing_users_;
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc index 9abe621..1631746 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc
@@ -41,7 +41,7 @@ #include "chrome/browser/chromeos/login/existing_user_controller.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/login/login_wizard.h" -#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" +#include "chrome/browser/chromeos/login/screens/core_oobe_view.h" #include "chrome/browser/chromeos/login/signin/token_handle_util.h" #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" @@ -1024,11 +1024,11 @@ if (new_bounds.IsEmpty()) { // Keyboard has been hidden. if (GetOobeUI()) - GetOobeUI()->GetCoreOobeActor()->ShowControlBar(true); + GetOobeUI()->GetCoreOobeView()->ShowControlBar(true); } else if (!new_bounds.IsEmpty()) { // Keyboard has been shown. if (GetOobeUI()) - GetOobeUI()->GetCoreOobeActor()->ShowControlBar(false); + GetOobeUI()->GetCoreOobeView()->ShowControlBar(false); } } @@ -1055,8 +1055,8 @@ if (GetOobeUI()) { const gfx::Size& size = primary_display.size(); - GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), - size.height()); + GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), + size.height()); } } @@ -1329,7 +1329,7 @@ void LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest() { static_cast<chromeos::LoginDisplayHostImpl*>(default_host()) ->GetOobeUI() - ->GetGaiaScreenActor() + ->GetGaiaScreenView() ->DisableRestrictiveProxyCheckForTest(); }
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index a5be676..851dbcd 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -372,41 +372,41 @@ } else if (screen == OobeScreen::SCREEN_OOBE_EULA) { return new EulaScreen(this, this, oobe_ui_->GetEulaView()); } else if (screen == OobeScreen::SCREEN_OOBE_ENROLLMENT) { - return new EnrollmentScreen(this, oobe_ui_->GetEnrollmentScreenActor()); + return new EnrollmentScreen(this, oobe_ui_->GetEnrollmentScreenView()); } else if (screen == OobeScreen::SCREEN_OOBE_RESET) { return new chromeos::ResetScreen(this, oobe_ui_->GetResetView()); } else if (screen == OobeScreen::SCREEN_OOBE_ENABLE_DEBUGGING) { return new EnableDebuggingScreen(this, - oobe_ui_->GetEnableDebuggingScreenActor()); + oobe_ui_->GetEnableDebuggingScreenView()); } else if (screen == OobeScreen::SCREEN_KIOSK_ENABLE) { - return new KioskEnableScreen(this, oobe_ui_->GetKioskEnableScreenActor()); + return new KioskEnableScreen(this, oobe_ui_->GetKioskEnableScreenView()); } else if (screen == OobeScreen::SCREEN_KIOSK_AUTOLAUNCH) { return new KioskAutolaunchScreen(this, - oobe_ui_->GetKioskAutolaunchScreenActor()); + oobe_ui_->GetKioskAutolaunchScreenView()); } else if (screen == OobeScreen::SCREEN_TERMS_OF_SERVICE) { return new TermsOfServiceScreen(this, - oobe_ui_->GetTermsOfServiceScreenActor()); + oobe_ui_->GetTermsOfServiceScreenView()); } else if (screen == OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE) { return new ArcTermsOfServiceScreen( - this, oobe_ui_->GetArcTermsOfServiceScreenActor()); + this, oobe_ui_->GetArcTermsOfServiceScreenView()); } else if (screen == OobeScreen::SCREEN_WRONG_HWID) { - return new WrongHWIDScreen(this, oobe_ui_->GetWrongHWIDScreenActor()); + return new WrongHWIDScreen(this, oobe_ui_->GetWrongHWIDScreenView()); } else if (screen == OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW) { return new SupervisedUserCreationScreen( - this, oobe_ui_->GetSupervisedUserCreationScreenActor()); + this, oobe_ui_->GetSupervisedUserCreationScreenView()); } else if (screen == OobeScreen::SCREEN_OOBE_HID_DETECTION) { return new chromeos::HIDDetectionScreen(this, oobe_ui_->GetHIDDetectionView()); } else if (screen == OobeScreen::SCREEN_AUTO_ENROLLMENT_CHECK) { return new AutoEnrollmentCheckScreen( - this, oobe_ui_->GetAutoEnrollmentCheckScreenActor()); + this, oobe_ui_->GetAutoEnrollmentCheckScreenView()); } else if (screen == OobeScreen::SCREEN_OOBE_CONTROLLER_PAIRING) { if (!shark_controller_) { shark_controller_.reset( new pairing_chromeos::BluetoothControllerPairingController()); } return new ControllerPairingScreen( - this, this, oobe_ui_->GetControllerPairingScreenActor(), + this, this, oobe_ui_->GetControllerPairingScreenView(), shark_controller_.get()); } else if (screen == OobeScreen::SCREEN_OOBE_HOST_PAIRING) { if (!remora_controller_) { @@ -416,11 +416,11 @@ remora_controller_->StartPairing(); } return new HostPairingScreen(this, this, - oobe_ui_->GetHostPairingScreenActor(), + oobe_ui_->GetHostPairingScreenView(), remora_controller_.get()); } else if (screen == OobeScreen::SCREEN_DEVICE_DISABLED) { return new DeviceDisabledScreen(this, - oobe_ui_->GetDeviceDisabledScreenActor()); + oobe_ui_->GetDeviceDisabledScreenView()); } return nullptr;
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index ebebd51..7e0f1b7 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -25,7 +25,7 @@ #include "chrome/browser/chromeos/login/screens/device_disabled_screen.h" #include "chrome/browser/chromeos/login/screens/error_screen.h" #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" -#include "chrome/browser/chromeos/login/screens/mock_device_disabled_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/mock_device_disabled_screen_view.h" #include "chrome/browser/chromeos/login/screens/mock_enable_debugging_screen.h" #include "chrome/browser/chromeos/login/screens/mock_eula_screen.h" #include "chrome/browser/chromeos/login/screens/mock_network_screen.h" @@ -200,13 +200,12 @@ class MockOutShowHide : public T { public: template <class P> explicit MockOutShowHide(P p) : T(p) {} - template <class P> MockOutShowHide(P p, H* actor) - : T(p, actor), actor_(actor) {} + template <class P> + MockOutShowHide(P p, H* view) : T(p, view), view_(view) {} template <class P, class Q> - MockOutShowHide(P p, Q q, H* actor) - : T(p, q, actor), actor_(actor) {} + MockOutShowHide(P p, Q q, H* view) : T(p, q, view), view_(view) {} - H* actor() const { return actor_.get(); } + H* view() const { return view_.get(); } MOCK_METHOD0(Show, void()); MOCK_METHOD0(Hide, void()); @@ -220,24 +219,24 @@ } private: - std::unique_ptr<H> actor_; + std::unique_ptr<H> view_; }; -#define MOCK(mock_var, screen_name, mocked_class, actor_class) \ - mock_var = new MockOutShowHide<mocked_class, actor_class>( \ - WizardController::default_controller(), new actor_class); \ +#define MOCK(mock_var, screen_name, mocked_class, view_class) \ + mock_var = new MockOutShowHide<mocked_class, view_class>( \ + WizardController::default_controller(), new view_class); \ WizardController::default_controller()->screens_[screen_name] = \ make_linked_ptr(mock_var); \ EXPECT_CALL(*mock_var, Show()).Times(0); \ EXPECT_CALL(*mock_var, Hide()).Times(0); -#define MOCK_WITH_DELEGATE(mock_var, screen_name, mocked_class, actor_class) \ - mock_var = new MockOutShowHide<mocked_class, actor_class>( \ - WizardController::default_controller(), \ - WizardController::default_controller(), new actor_class); \ - WizardController::default_controller()->screens_[screen_name] = \ - make_linked_ptr(mock_var); \ - EXPECT_CALL(*mock_var, Show()).Times(0); \ +#define MOCK_WITH_DELEGATE(mock_var, screen_name, mocked_class, view_class) \ + mock_var = new MockOutShowHide<mocked_class, view_class>( \ + WizardController::default_controller(), \ + WizardController::default_controller(), new view_class); \ + WizardController::default_controller()->screens_[screen_name] = \ + make_linked_ptr(mock_var); \ + EXPECT_CALL(*mock_var, Show()).Times(0); \ EXPECT_CALL(*mock_var, Hide()).Times(0); class WizardControllerTest : public WizardInProcessBrowserTest { @@ -433,20 +432,20 @@ MOCK_WITH_DELEGATE(mock_eula_screen_, OobeScreen::SCREEN_OOBE_EULA, MockEulaScreen, MockEulaView); MOCK(mock_enrollment_screen_, OobeScreen::SCREEN_OOBE_ENROLLMENT, - MockEnrollmentScreen, MockEnrollmentScreenActor); + MockEnrollmentScreen, MockEnrollmentScreenView); MOCK(mock_auto_enrollment_check_screen_, OobeScreen::SCREEN_AUTO_ENROLLMENT_CHECK, - MockAutoEnrollmentCheckScreen, MockAutoEnrollmentCheckScreenActor); + MockAutoEnrollmentCheckScreen, MockAutoEnrollmentCheckScreenView); MOCK(mock_wrong_hwid_screen_, OobeScreen::SCREEN_WRONG_HWID, - MockWrongHWIDScreen, MockWrongHWIDScreenActor); + MockWrongHWIDScreen, MockWrongHWIDScreenView); MOCK(mock_enable_debugging_screen_, OobeScreen::SCREEN_OOBE_ENABLE_DEBUGGING, MockEnableDebuggingScreen, - MockEnableDebuggingScreenActor); - device_disabled_screen_actor_.reset(new MockDeviceDisabledScreenActor); + MockEnableDebuggingScreenView); + device_disabled_screen_view_.reset(new MockDeviceDisabledScreenView); wizard_controller->screens_[OobeScreen::SCREEN_DEVICE_DISABLED] = make_linked_ptr(new DeviceDisabledScreen( - wizard_controller, device_disabled_screen_actor_.get())); - EXPECT_CALL(*device_disabled_screen_actor_, Show()).Times(0); + wizard_controller, device_disabled_screen_view_.get())); + EXPECT_CALL(*device_disabled_screen_view_, Show()).Times(0); // Switch to the initial screen. EXPECT_EQ(NULL, wizard_controller->current_screen()); @@ -456,7 +455,7 @@ void TearDownOnMainThread() override { mock_network_screen_.reset(); - device_disabled_screen_actor_.reset(); + device_disabled_screen_view_.reset(); WizardControllerTest::TearDownOnMainThread(); } @@ -520,15 +519,16 @@ linked_ptr<MockNetworkScreen> mock_network_screen_; MockOutShowHide<MockUpdateScreen, MockUpdateView>* mock_update_screen_; MockOutShowHide<MockEulaScreen, MockEulaView>* mock_eula_screen_; - MockOutShowHide<MockEnrollmentScreen, - MockEnrollmentScreenActor>* mock_enrollment_screen_; + MockOutShowHide<MockEnrollmentScreen, MockEnrollmentScreenView>* + mock_enrollment_screen_; MockOutShowHide<MockAutoEnrollmentCheckScreen, - MockAutoEnrollmentCheckScreenActor>* mock_auto_enrollment_check_screen_; - MockOutShowHide<MockWrongHWIDScreen, MockWrongHWIDScreenActor>* + MockAutoEnrollmentCheckScreenView>* + mock_auto_enrollment_check_screen_; + MockOutShowHide<MockWrongHWIDScreen, MockWrongHWIDScreenView>* mock_wrong_hwid_screen_; - MockOutShowHide<MockEnableDebuggingScreen, - MockEnableDebuggingScreenActor>* mock_enable_debugging_screen_; - std::unique_ptr<MockDeviceDisabledScreenActor> device_disabled_screen_actor_; + MockOutShowHide<MockEnableDebuggingScreen, MockEnableDebuggingScreenView>* + mock_enable_debugging_screen_; + std::unique_ptr<MockDeviceDisabledScreenView> device_disabled_screen_view_; private: NetworkPortalDetectorTestImpl* network_portal_detector_; @@ -672,7 +672,7 @@ EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0); EXPECT_CALL(*mock_update_screen_, Show()).Times(0); WizardController::default_controller()->SkipUpdateEnrollAfterEula(); - EXPECT_CALL(*mock_enrollment_screen_->actor(), + EXPECT_CALL(*mock_enrollment_screen_->view(), SetParameters( mock_enrollment_screen_, EnrollmentModeMatches(policy::EnrollmentConfig::MODE_MANUAL))) @@ -715,7 +715,7 @@ ControlFlowEnrollmentCompleted) { CheckCurrentScreen(OobeScreen::SCREEN_OOBE_NETWORK); EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0); - EXPECT_CALL(*mock_enrollment_screen_->actor(), + EXPECT_CALL(*mock_enrollment_screen_->view(), SetParameters( mock_enrollment_screen_, EnrollmentModeMatches(policy::EnrollmentConfig::MODE_MANUAL))) @@ -877,7 +877,7 @@ g_browser_process->local_state()->Set(prefs::kServerBackedDeviceState, device_state); EXPECT_CALL(*mock_enrollment_screen_, Show()).Times(1); - EXPECT_CALL(*mock_enrollment_screen_->actor(), + EXPECT_CALL(*mock_enrollment_screen_->view(), SetParameters(mock_enrollment_screen_, EnrollmentModeMatches( policy::EnrollmentConfig::MODE_SERVER_FORCED))) @@ -966,9 +966,9 @@ device_state.SetString(policy::kDeviceStateDisabledMessage, kDisabledMessage); g_browser_process->local_state()->Set(prefs::kServerBackedDeviceState, device_state); - EXPECT_CALL(*device_disabled_screen_actor_, - UpdateMessage(kDisabledMessage)).Times(1); - EXPECT_CALL(*device_disabled_screen_actor_, Show()).Times(1); + EXPECT_CALL(*device_disabled_screen_view_, UpdateMessage(kDisabledMessage)) + .Times(1); + EXPECT_CALL(*device_disabled_screen_view_, Show()).Times(1); OnExit(*mock_auto_enrollment_check_screen_, BaseScreenDelegate::ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED); @@ -1112,7 +1112,7 @@ IN_PROC_BROWSER_TEST_F(WizardControllerKioskFlowTest, ControlFlowKioskForcedEnrollment) { - EXPECT_CALL(*mock_enrollment_screen_->actor(), + EXPECT_CALL(*mock_enrollment_screen_->view(), SetParameters(mock_enrollment_screen_, EnrollmentModeMatches( policy::EnrollmentConfig::MODE_LOCAL_FORCED))) @@ -1154,7 +1154,7 @@ IN_PROC_BROWSER_TEST_F(WizardControllerKioskFlowTest, ControlFlowEnrollmentBack) { - EXPECT_CALL(*mock_enrollment_screen_->actor(), + EXPECT_CALL(*mock_enrollment_screen_->view(), SetParameters(mock_enrollment_screen_, EnrollmentModeMatches( policy::EnrollmentConfig::MODE_LOCAL_FORCED))) @@ -1256,7 +1256,7 @@ MOCK_WITH_DELEGATE(mock_network_screen_, OobeScreen::SCREEN_OOBE_NETWORK, MockNetworkScreen, MockNetworkView); MOCK(mock_enrollment_screen_, OobeScreen::SCREEN_OOBE_ENROLLMENT, - MockEnrollmentScreen, MockEnrollmentScreenActor); + MockEnrollmentScreen, MockEnrollmentScreenView); } void OnExit(BaseScreen& screen, BaseScreenDelegate::ExitCodes exit_code) { @@ -1269,8 +1269,8 @@ } MockOutShowHide<MockNetworkScreen, MockNetworkView>* mock_network_screen_; - MockOutShowHide<MockEnrollmentScreen, - MockEnrollmentScreenActor>* mock_enrollment_screen_; + MockOutShowHide<MockEnrollmentScreen, MockEnrollmentScreenView>* + mock_enrollment_screen_; private: DISALLOW_COPY_AND_ASSIGN(WizardControllerOobeResumeTest); @@ -1283,7 +1283,7 @@ WizardController::default_controller()->AdvanceToScreen( OobeScreen::SCREEN_OOBE_NETWORK); CheckCurrentScreen(OobeScreen::SCREEN_OOBE_NETWORK); - EXPECT_CALL(*mock_enrollment_screen_->actor(), + EXPECT_CALL(*mock_enrollment_screen_->view(), SetParameters( mock_enrollment_screen_, EnrollmentModeMatches(policy::EnrollmentConfig::MODE_MANUAL)))
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index a5eeea9f..3baf9c98 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc
@@ -58,8 +58,21 @@ namespace chromeos { +namespace { + static const char kFallbackInputMethodLocale[] = "en-US"; +// The keyboard preferences that determine how we remap modifier keys. These +// preferences will be saved in global user preferences dictionary so that they +// can be used on signin screen. +const char* const kLanguageRemapPrefs[] = { + prefs::kLanguageRemapSearchKeyTo, prefs::kLanguageRemapControlKeyTo, + prefs::kLanguageRemapAltKeyTo, prefs::kLanguageRemapCapsLockKeyTo, + prefs::kLanguageRemapEscapeKeyTo, prefs::kLanguageRemapBackspaceKeyTo, + prefs::kLanguageRemapDiamondKeyTo}; + +} // namespace + Preferences::Preferences() : prefs_(NULL), input_method_manager_(input_method::InputMethodManager::Get()), @@ -400,6 +413,8 @@ pref_change_registrar_.Init(prefs); pref_change_registrar_.Add(prefs::kResolveTimezoneByGeolocation, callback); pref_change_registrar_.Add(prefs::kUse24HourClock, callback); + for (auto remap_pref : kLanguageRemapPrefs) + pref_change_registrar_.Add(remap_pref, callback); } void Preferences::Init(Profile* profile, const user_manager::User* user) { @@ -715,6 +730,14 @@ prefs::kUse24HourClock, value); } + for (auto remap_pref : kLanguageRemapPrefs) { + if (pref_name == remap_pref || reason != REASON_ACTIVE_USER_CHANGED) { + const int value = prefs_->GetInteger(remap_pref); + user_manager::known_user::SetIntegerPref(user_->GetAccountId(), + remap_pref, value); + } + } + system::InputDeviceSettings::Get()->UpdateTouchDevicesStatusFromPrefs(); }
diff --git a/chrome/browser/chromeos/system/device_disabling_browsertest.cc b/chrome/browser/chromeos/system/device_disabling_browsertest.cc index 66bf309..23a0d934 100644 --- a/chrome/browser/chromeos/system/device_disabling_browsertest.cc +++ b/chrome/browser/chromeos/system/device_disabling_browsertest.cc
@@ -203,7 +203,7 @@ ASSERT_TRUE(network_state_informer); network_state_informer->AddObserver(this); SigninScreenHandler* const signin_screen_handler = - oobe_ui->signin_screen_handler_for_test(); + oobe_ui->signin_screen_handler(); ASSERT_TRUE(signin_screen_handler); signin_screen_handler->ZeroOfflineTimeoutForTesting(); SimulateNetworkOffline();
diff --git a/chrome/browser/component_updater/ev_whitelist_component_installer.cc b/chrome/browser/component_updater/ev_whitelist_component_installer.cc index c0bf9c9..0f4f0a0 100644 --- a/chrome/browser/component_updater/ev_whitelist_component_installer.cc +++ b/chrome/browser/component_updater/ev_whitelist_component_installer.cc
@@ -15,6 +15,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/path_service.h" +#include "base/task_scheduler/post_task.h" #include "base/threading/sequenced_worker_pool.h" #include "base/version.h" #include "components/component_updater/component_updater_paths.h" @@ -106,11 +107,11 @@ VLOG(1) << "Component ready, version " << version.GetString() << " in " << install_dir.value(); - if (!content::BrowserThread::PostBlockingPoolTask( - FROM_HERE, base::Bind(&LoadWhitelistFromDisk, - GetInstalledPath(install_dir), version))) { - NOTREACHED(); - } + base::PostTaskWithTraits(FROM_HERE, + base::TaskTraits().MayBlock().WithPriority( + base::TaskPriority::BACKGROUND), + base::Bind(&LoadWhitelistFromDisk, + GetInstalledPath(install_dir), version)); } // Called during startup and installation before ComponentReady().
diff --git a/chrome/browser/component_updater/file_type_policies_component_installer.cc b/chrome/browser/component_updater/file_type_policies_component_installer.cc index 06e076a3..1f81a547 100644 --- a/chrome/browser/component_updater/file_type_policies_component_installer.cc +++ b/chrome/browser/component_updater/file_type_policies_component_installer.cc
@@ -15,10 +15,10 @@ #include "base/logging.h" #include "base/macros.h" #include "base/path_service.h" +#include "base/task_scheduler/post_task.h" #include "base/version.h" #include "chrome/common/safe_browsing/file_type_policies.h" #include "components/component_updater/component_updater_paths.h" -#include "content/public/browser/browser_thread.h" using component_updater::ComponentUpdateService; @@ -85,11 +85,11 @@ VLOG(1) << "Component ready, version " << version.GetString() << " in " << install_dir.value(); - if (!content::BrowserThread::PostBlockingPoolTask( - FROM_HERE, - base::Bind(&LoadFileTypesFromDisk, GetInstalledPath(install_dir)))) { - NOTREACHED(); - } + base::PostTaskWithTraits( + FROM_HERE, + base::TaskTraits().MayBlock().WithPriority( + base::TaskPriority::BACKGROUND), + base::Bind(&LoadFileTypesFromDisk, GetInstalledPath(install_dir))); } // Called during startup and installation before ComponentReady().
diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index 086d405d..9f79c136 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc
@@ -341,7 +341,16 @@ update_client::InstallerAttributes FlashComponentInstallerTraits::GetInstallerAttributes() const { - return update_client::InstallerAttributes(); + // For Chrome OS, send the built-in flash player version to the server, + // otherwise it will serve component updates of outdated flash players. + update_client::InstallerAttributes attrs; +#if defined(OS_CHROMEOS) + const std::string flash_version = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kPpapiFlashVersion); + attrs["built_in_version"] = flash_version; +#endif // #defined(OS_CHROMEOS) + return attrs; } std::vector<std::string> FlashComponentInstallerTraits::GetMimeTypes() const {
diff --git a/chrome/browser/component_updater/sw_reporter_installer_win.cc b/chrome/browser/component_updater/sw_reporter_installer_win.cc index c558cfd..b3d32a7 100644 --- a/chrome/browser/component_updater/sw_reporter_installer_win.cc +++ b/chrome/browser/component_updater/sw_reporter_installer_win.cc
@@ -29,7 +29,6 @@ #include "base/strings/string_tokenizer.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "base/task_scheduler/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "base/win/registry.h" @@ -138,17 +137,7 @@ const base::Version& version) { content::BrowserThread::PostAfterStartupTask( FROM_HERE, base::ThreadTaskRunnerHandle::Get(), - base::Bind(&safe_browsing::RunSwReporters, invocations, version, - base::ThreadTaskRunnerHandle::Get(), - // Runs LaunchAndWaitForExit() which creates (MayBlock()) and - // joins (WithBaseSyncPrimitives()) a process. - base::CreateTaskRunnerWithTraits( - base::TaskTraits() - .WithShutdownBehavior( - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) - .WithPriority(base::TaskPriority::BACKGROUND) - .MayBlock() - .WithBaseSyncPrimitives()))); + base::Bind(&safe_browsing::RunSwReporters, invocations, version)); } // Ensures |str| contains only alphanumeric characters and characters from
diff --git a/chrome/browser/conflicts/OWNERS b/chrome/browser/conflicts/OWNERS index 2ffdf656..186b2df 100644 --- a/chrome/browser/conflicts/OWNERS +++ b/chrome/browser/conflicts/OWNERS
@@ -1,2 +1,4 @@ chrisha@chromium.org pmonette@chromium.org + +# COMPONENT: Internals>Core
diff --git a/chrome/browser/downgrade/OWNER b/chrome/browser/downgrade/OWNER deleted file mode 100644 index 975e914..0000000 --- a/chrome/browser/downgrade/OWNER +++ /dev/null
@@ -1 +0,0 @@ -georgesak@chromium.org
diff --git a/chrome/browser/downgrade/OWNERS b/chrome/browser/downgrade/OWNERS new file mode 100644 index 0000000..fcf1b41 --- /dev/null +++ b/chrome/browser/downgrade/OWNERS
@@ -0,0 +1,2 @@ +georgesak@chromium.org +zmin@chromium.org
diff --git a/chrome/browser/local_discovery/OWNERS b/chrome/browser/local_discovery/OWNERS index 58265a3..4633094 100644 --- a/chrome/browser/local_discovery/OWNERS +++ b/chrome/browser/local_discovery/OWNERS
@@ -1,2 +1,4 @@ gene@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/browser/predictors/resource_prefetcher.cc b/chrome/browser/predictors/resource_prefetcher.cc index cc1d466..69607a6e 100644 --- a/chrome/browser/predictors/resource_prefetcher.cc +++ b/chrome/browser/predictors/resource_prefetcher.cc
@@ -140,7 +140,7 @@ void ResourcePrefetcher::SendRequest(const GURL& url) { std::unique_ptr<net::URLRequest> url_request = - delegate_->GetURLRequestContext()->CreateRequest(url, net::LOW, this); + delegate_->GetURLRequestContext()->CreateRequest(url, net::IDLE, this); host_inflight_counts_[url.host()] += 1; url_request->set_method("GET");
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 7403f6bd..d57d2c7 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc
@@ -778,6 +778,8 @@ void PrerenderContents::AddNetworkBytes(int64_t bytes) { network_bytes_ += bytes; + for (Observer& observer : observer_list_) + observer.OnPrerenderNetworkBytesChanged(this); } } // namespace prerender
diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h index 1926ce3..082fa62d 100644 --- a/chrome/browser/prerender/prerender_contents.h +++ b/chrome/browser/prerender/prerender_contents.h
@@ -89,6 +89,10 @@ // destroyed. virtual void OnPrerenderStop(PrerenderContents* contents) {} + // Signals that a resource finished loading and altered the running byte + // count. + virtual void OnPrerenderNetworkBytesChanged(PrerenderContents* contents) {} + protected: Observer() {} virtual ~Observer() = 0; @@ -238,6 +242,9 @@ return prerendering_has_been_cancelled_; } + // Running byte count. Increased when each resource completes loading. + int64_t network_bytes() { return network_bytes_; } + protected: PrerenderContents(PrerenderManager* prerender_manager, Profile* profile,
diff --git a/chrome/browser/prerender/prerender_handle.cc b/chrome/browser/prerender/prerender_handle.cc index 8c51ff7..ee6f638f 100644 --- a/chrome/browser/prerender/prerender_handle.cc +++ b/chrome/browser/prerender/prerender_handle.cc
@@ -109,6 +109,13 @@ observer_->OnPrerenderStop(this); } +void PrerenderHandle::OnPrerenderNetworkBytesChanged( + PrerenderContents* prerender_contents) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + if (observer_) + observer_->OnPrerenderNetworkBytesChanged(this); +} + bool PrerenderHandle::RepresentingSamePrerenderAs( PrerenderHandle* other) const { return other && other->prerender_data_ && prerender_data_ &&
diff --git a/chrome/browser/prerender/prerender_handle.h b/chrome/browser/prerender/prerender_handle.h index 9beac51..e16fed1d 100644 --- a/chrome/browser/prerender/prerender_handle.h +++ b/chrome/browser/prerender/prerender_handle.h
@@ -38,6 +38,10 @@ // Signals that the prerender has stopped running. virtual void OnPrerenderStop(PrerenderHandle* handle) = 0; + // Signals that a resource finished loading and altered the running byte + // count. + virtual void OnPrerenderNetworkBytesChanged(PrerenderHandle* handle) = 0; + protected: Observer(); virtual ~Observer(); @@ -86,6 +90,8 @@ void OnPrerenderDomContentLoaded( PrerenderContents* prerender_contents) override; void OnPrerenderStop(PrerenderContents* prerender_contents) override; + void OnPrerenderNetworkBytesChanged( + PrerenderContents* prerender_contents) override; Observer* observer_;
diff --git a/chrome/browser/prerender/prerender_link_manager.cc b/chrome/browser/prerender/prerender_link_manager.cc index c764f4c..e54068d 100644 --- a/chrome/browser/prerender/prerender_link_manager.cc +++ b/chrome/browser/prerender/prerender_link_manager.cc
@@ -132,6 +132,8 @@ } } + void OnPrerenderNetworkBytesChanged(PrerenderContents* launcher) override {} + private: // A pointer to the parent PrerenderLinkManager. PrerenderLinkManager* link_manager_; @@ -531,4 +533,7 @@ StartPrerenders(); } +void PrerenderLinkManager::OnPrerenderNetworkBytesChanged( + PrerenderHandle* prerender_handle) {} + } // namespace prerender
diff --git a/chrome/browser/prerender/prerender_link_manager.h b/chrome/browser/prerender/prerender_link_manager.h index 2348b85..d7e3d9b 100644 --- a/chrome/browser/prerender/prerender_link_manager.h +++ b/chrome/browser/prerender/prerender_link_manager.h
@@ -149,6 +149,8 @@ void OnPrerenderStopLoading(PrerenderHandle* prerender_handle) override; void OnPrerenderDomContentLoaded(PrerenderHandle* prerender_handle) override; void OnPrerenderStop(PrerenderHandle* prerender_handle) override; + void OnPrerenderNetworkBytesChanged( + PrerenderHandle* prerender_handle) override; bool has_shutdown_;
diff --git a/chrome/browser/prerender/prerender_unittest.cc b/chrome/browser/prerender/prerender_unittest.cc index be3bfa0..f949fc8 100644 --- a/chrome/browser/prerender/prerender_unittest.cc +++ b/chrome/browser/prerender/prerender_unittest.cc
@@ -96,6 +96,30 @@ FinalStatus expected_final_status_; }; +class TestNetworkBytesChangedObserver + : public prerender::PrerenderHandle::Observer { + public: + TestNetworkBytesChangedObserver() : network_bytes_changed_(false) {} + + // prerender::PrerenderHandle::Observer + void OnPrerenderStart(PrerenderHandle* prerender_handle) override {} + void OnPrerenderStopLoading(PrerenderHandle* prerender_handle) override {} + void OnPrerenderDomContentLoaded(PrerenderHandle* prerender_handle) override { + } + void OnPrerenderStop(PrerenderHandle* prerender_handle) override {} + void OnPrerenderNetworkBytesChanged( + PrerenderHandle* prerender_handle) override { + network_bytes_changed_ = true; + } + + bool network_bytes_changed() const { return network_bytes_changed_; } + + private: + bool network_bytes_changed_; + + DISALLOW_COPY_AND_ASSIGN(TestNetworkBytesChangedObserver); +}; + int DummyPrerenderContents::g_next_route_id_ = 0; const gfx::Size kSize(640, 480); @@ -1999,4 +2023,20 @@ EXPECT_FALSE(prerender_contents->IsValidHttpMethod("WHATEVER")); } +TEST_F(PrerenderTest, PrerenderContentsIncrementsByteCount) { + GURL url("http://www.google.com/"); + DummyPrerenderContents* prerender_contents = nullptr; + prerender_contents = prerender_manager()->CreateNextPrerenderContents( + url, ORIGIN_OFFLINE, FINAL_STATUS_MANAGER_SHUTDOWN); + std::unique_ptr<PrerenderHandle> prerender_handle = + prerender_manager()->AddPrerenderForOffline(url, nullptr, kSize); + + TestNetworkBytesChangedObserver observer; + prerender_handle->SetObserver(&observer); + + prerender_contents->AddNetworkBytes(12); + EXPECT_TRUE(observer.network_bytes_changed()); + EXPECT_EQ(12, prerender_contents->network_bytes()); +} + } // namespace prerender
diff --git a/chrome/browser/printing/cloud_print/OWNERS b/chrome/browser/printing/cloud_print/OWNERS index adb99ff8..3a21c291 100644 --- a/chrome/browser/printing/cloud_print/OWNERS +++ b/chrome/browser/printing/cloud_print/OWNERS
@@ -1,3 +1,5 @@ gene@chromium.org scottbyer@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/browser/profiles/OWNERS b/chrome/browser/profiles/OWNERS index 9b3d1bc..57502e8 100644 --- a/chrome/browser/profiles/OWNERS +++ b/chrome/browser/profiles/OWNERS
@@ -16,3 +16,5 @@ per-file incognito_mode_policy_handler*=atwilson@chromium.org per-file host_zoom_map_browsertest.cc=wjmaclean@chromium.org + +# COMPONENT: UI>Browser>Profiles
diff --git a/chrome/browser/renderer_host/chrome_extension_message_filter.cc b/chrome/browser/renderer_host/chrome_extension_message_filter.cc index 2306f56..0ba1d828 100644 --- a/chrome/browser/renderer_host/chrome_extension_message_filter.cc +++ b/chrome/browser/renderer_host/chrome_extension_message_filter.cc
@@ -13,7 +13,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" -#include "base/threading/sequenced_worker_pool.h" +#include "base/task_scheduler/post_task.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/activity_log/activity_action_constants.h" @@ -245,20 +245,18 @@ paths_to_load.push_back(imported_extension->path()); } - BrowserThread::PostBlockingPoolTask( - FROM_HERE, - base::Bind( - &ChromeExtensionMessageFilter::OnGetExtMessageBundleOnBlockingPool, - this, paths_to_load, extension_id, default_locale, reply_msg)); + // This blocks tab loading. Priority is inherited from the calling context. + base::PostTaskWithTraits( + FROM_HERE, base::TaskTraits().MayBlock(), + base::Bind(&ChromeExtensionMessageFilter::OnGetExtMessageBundleAsync, + this, paths_to_load, extension_id, default_locale, reply_msg)); } -void ChromeExtensionMessageFilter::OnGetExtMessageBundleOnBlockingPool( +void ChromeExtensionMessageFilter::OnGetExtMessageBundleAsync( const std::vector<base::FilePath>& extension_paths, const std::string& main_extension_id, const std::string& default_locale, IPC::Message* reply_msg) { - DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - std::unique_ptr<extensions::MessageBundle::SubstitutionMap> dictionary_map( extensions::file_util::LoadMessageBundleSubstitutionMapFromPaths( extension_paths, main_extension_id, default_locale));
diff --git a/chrome/browser/renderer_host/chrome_extension_message_filter.h b/chrome/browser/renderer_host/chrome_extension_message_filter.h index b746f50..55568bd 100644 --- a/chrome/browser/renderer_host/chrome_extension_message_filter.h +++ b/chrome/browser/renderer_host/chrome_extension_message_filter.h
@@ -71,7 +71,7 @@ const extensions::Message& message); void OnGetExtMessageBundle(const std::string& extension_id, IPC::Message* reply_msg); - void OnGetExtMessageBundleOnBlockingPool( + void OnGetExtMessageBundleAsync( const std::vector<base::FilePath>& extension_paths, const std::string& main_extension_id, const std::string& default_locale,
diff --git a/chrome/browser/resources/cloud_print_app/OWNERS b/chrome/browser/resources/cloud_print_app/OWNERS index 58265a3..4633094 100644 --- a/chrome/browser/resources/cloud_print_app/OWNERS +++ b/chrome/browser/resources/cloud_print_app/OWNERS
@@ -1,2 +1,4 @@ gene@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/browser/resources/inspect/inspect.css b/chrome/browser/resources/inspect/inspect.css index 86b22a5b..b25cb2e 100644 --- a/chrome/browser/resources/inspect/inspect.css +++ b/chrome/browser/resources/inspect/inspect.css
@@ -11,6 +11,7 @@ font-size: 13px; margin: 0; min-width: 47em; + overflow: hidden; } .hidden {
diff --git a/chrome/browser/resources/local_discovery/OWNERS b/chrome/browser/resources/local_discovery/OWNERS index 58265a3..4633094 100644 --- a/chrome/browser/resources/local_discovery/OWNERS +++ b/chrome/browser/resources/local_discovery/OWNERS
@@ -1,2 +1,4 @@ gene@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/browser/resources/print_preview/OWNERS b/chrome/browser/resources/print_preview/OWNERS index a13ff1cd..ef10fbb9 100644 --- a/chrome/browser/resources/print_preview/OWNERS +++ b/chrome/browser/resources/print_preview/OWNERS
@@ -1,3 +1,5 @@ dpapad@chromium.org gene@chromium.org vitalybuka@chromium.org + +# COMPONENT: UI>Browser>PrintPreview
diff --git a/chrome/browser/resources/settings/about_page/about_page.html b/chrome/browser/resources/settings/about_page/about_page.html index b117220..977c71bb 100644 --- a/chrome/browser/resources/settings/about_page/about_page.html +++ b/chrome/browser/resources/settings/about_page/about_page.html
@@ -58,7 +58,7 @@ iron-icon { -webkit-margin-end: var(--about-page-image-space); - width: 32px; /* The width of the product-logo img. */ + min-width: 32px; /* The width of the product-logo img. */ } iron-icon[icon='settings:check-circle'] { @@ -69,6 +69,10 @@ fill: var(--paper-red-600); } + .settings-box .start { + overflow-x: auto; + } + #regulatoryInfo img { width: 330px; }
diff --git a/chrome/browser/resources/settings/about_page/about_page.js b/chrome/browser/resources/settings/about_page/about_page.js index 0f54c43..cb26f366 100644 --- a/chrome/browser/resources/settings/about_page/about_page.js +++ b/chrome/browser/resources/settings/about_page/about_page.js
@@ -277,17 +277,16 @@ return this.i18n('aboutUpgradeUpdating'); default: function formatMessage(msg) { - return '<div>' + - parseHtmlSubset('<b>' + msg + '</b>').firstChild.innerHTML + - '</div>'; + return parseHtmlSubset( + '<b>' + msg + '</b>', ['br', 'pre']).firstChild.innerHTML; } var result = ''; var message = this.currentUpdateStatusEvent_.message; - if (!!message) + if (message) result += formatMessage(message); var connectMessage = this.currentUpdateStatusEvent_.connectionTypes; - if (!!connectMessage) - result += formatMessage(connectMessage); + if (connectMessage) + result += '<div>' + formatMessage(connectMessage) + '</div>'; return result; } },
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.js b/chrome/browser/resources/vr_shell/vr_shell_ui.js index a6eedc1..de42168 100644 --- a/chrome/browser/resources/vr_shell/vr_shell_ui.js +++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js
@@ -51,14 +51,14 @@ element.setTranslation(0, 0, -this.BROWSING_SCREEN_DISTANCE); this.elementId = ui.addElement(element); - // Place an invisible but hittable plane behind the content quad, to keep - // the reticle roughly planar with the content if near content. + // Place an invisible (fill none) but hittable plane behind the content + // quad, to keep the reticle roughly planar with the content if near + // content. let backPlane = new api.UiElement(0, 0, 0, 0); - backPlane.setVisible(false); - backPlane.setHitTestable(true); backPlane.setSize(1000, 1000); backPlane.setTranslation(0, 0, -0.01); backPlane.setParentId(this.elementId); + backPlane.setFill(new api.NoFill()); ui.addElement(backPlane); this.updateState();
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js index 48d2f26..5090f826 100644 --- a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js +++ b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js
@@ -140,6 +140,12 @@ } } +api.NoFill = class extends api.Fill { + constructor() { + super(api.FillType.NONE); + } +} + api.Sprite = class extends api.Fill { constructor(pixelX, pixelY, pixelWidth, pixelHeight) { super(api.FillType.SPRITE);
diff --git a/chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc b/chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc index 0140984..8f80e7bb 100644 --- a/chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc +++ b/chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc
@@ -4,18 +4,25 @@ #include "chrome/browser/safe_browsing/srt_fetcher_win.h" +#include <initializer_list> #include <iterator> -#include <memory> #include <set> +#include <vector> #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/callback.h" #include "base/files/file_path.h" -#include "base/run_loop.h" +#include "base/memory/ref_counted.h" +#include "base/message_loop/message_loop.h" #include "base/test/scoped_feature_list.h" -#include "base/test/test_simple_task_runner.h" +#include "base/test/test_mock_time_task_runner.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" +#include "base/version.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/lifetime/keep_alive_types.h" +#include "chrome/browser/lifetime/scoped_keep_alive.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/safe_browsing/srt_client_info_win.h" #include "chrome/browser/ui/browser.h" @@ -25,7 +32,6 @@ #include "components/component_updater/pref_names.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing_db/safe_browsing_prefs.h" -#include "content/public/test/test_browser_thread_bundle.h" namespace safe_browsing { @@ -39,21 +45,67 @@ public SwReporterTestingDelegate { public: void SetUpInProcessBrowserTestFixture() override { - task_runner_ = new base::TestSimpleTaskRunner; - SetSwReporterTestingDelegate(this); } void SetUpOnMainThread() override { + // During the test, use a task runner with a mock clock. + saved_task_runner_ = base::ThreadTaskRunnerHandle::Get(); + ASSERT_NE(mock_time_task_runner_, saved_task_runner_); + base::MessageLoop::current()->SetTaskRunner(mock_time_task_runner_); + InProcessBrowserTest::SetUpOnMainThread(); + + // SetDateInLocalState calculates a time as Now() minus an offset. Move the + // simulated clock ahead far enough that this calculation won't underflow. + mock_time_task_runner_->FastForwardBy( + base::TimeDelta::FromDays(kDaysBetweenSuccessfulSwReporterRuns * 2)); + ClearLastTimeSentReport(); } + void TearDownOnMainThread() override { + // Restore the standard task runner to perform browser cleanup, which will + // wait forever with the mock clock. + base::MessageLoop::current()->SetTaskRunner(saved_task_runner_); + } + void TearDownInProcessBrowserTestFixture() override { SetSwReporterTestingDelegate(nullptr); } - void RunReporter(const base::FilePath& exe_path = base::FilePath()) { + // Records that the prompt was shown. + void TriggerPrompt(Browser* browser, const std::string& version) override { + prompt_trigger_called_ = true; + } + + // Records that the reporter was launched with the parameters given in + // |invocation|. + int LaunchReporter(const SwReporterInvocation& invocation) override { + ++reporter_launch_count_; + reporter_launch_parameters_.push_back(invocation); + if (first_launch_callback_) + std::move(first_launch_callback_).Run(); + return exit_code_to_report_; + } + + // Returns the test's idea of the current time. + base::Time Now() const override { return mock_time_task_runner_->Now(); } + + // Returns a task runner to use when launching the reporter (which is + // normally a blocking action). + base::TaskRunner* BlockingTaskRunner() const override { + // Use the test's main task runner so that we don't need to pump another + // message loop. Since the test calls LaunchReporter instead of actually + // doing a blocking reporter launch, it doesn't matter that the task runner + // doesn't have the MayBlock trait. + return mock_time_task_runner_.get(); + } + + // Schedules a single reporter to run. + void RunReporter(int exit_code_to_report, + const base::FilePath& exe_path = base::FilePath()) { + exit_code_to_report_ = exit_code_to_report; auto invocation = SwReporterInvocation::FromFilePath(exe_path); invocation.supported_behaviours = SwReporterInvocation::BEHAVIOUR_LOG_TO_RAPPOR | @@ -63,364 +115,259 @@ SwReporterQueue invocations; invocations.push(invocation); - RunSwReporters(invocations, base::Version("1.2.3"), task_runner_, - task_runner_); + RunSwReporters(invocations, base::Version("1.2.3")); } - void RunReporterQueue(const SwReporterQueue& invocations) { - RunSwReporters(invocations, base::Version("1.2.3"), task_runner_, - task_runner_); + // Schedules a queue of reporters to run. + void RunReporterQueue(int exit_code_to_report, + const SwReporterQueue& invocations) { + exit_code_to_report_ = exit_code_to_report; + RunSwReporters(invocations, base::Version("1.2.3")); } - void TriggerPrompt(Browser* browser, const std::string& version) override { - prompt_trigger_called_ = true; - } - - int LaunchReporter(const SwReporterInvocation& invocation) override { - ++reporter_launch_count_; - reporter_launch_parameters_ = invocation; - return exit_code_to_report_; - } - - void NotifyLaunchReady() override { launch_ready_notified_ = true; } - - void NotifyReporterDone() override { reporter_done_notified_ = true; } - // Sets |path| in the local state to a date corresponding to |days| days ago. void SetDateInLocalState(const std::string& path, int days) { PrefService* local_state = g_browser_process->local_state(); - DCHECK_NE(local_state, nullptr); - local_state->SetInt64(path, - (base::Time::Now() - base::TimeDelta::FromDays(days)) - .ToInternalValue()); + local_state->SetInt64( + path, (Now() - base::TimeDelta::FromDays(days)).ToInternalValue()); } - void SetDaysSinceLastReport(int days) { + // Sets local state for last time the software reporter ran to |days| days + // ago. + void SetDaysSinceLastTriggered(int days) { SetDateInLocalState(prefs::kSwReporterLastTimeTriggered, days); } - void ExpectToRunAgain(int days) { - ASSERT_TRUE(task_runner_->HasPendingTask()); - EXPECT_LE(task_runner_->NextPendingTaskDelay(), - base::TimeDelta::FromDays(days)); - EXPECT_GT(task_runner_->NextPendingTaskDelay(), - base::TimeDelta::FromDays(days) - base::TimeDelta::FromHours(1)); - } - - // Clears local state for last time the software reporter sent logs to |days| - // days ago. This prevents potential false positives that could arise from - // state not properly cleaned between successive tests. - void ClearLastTimeSentReport() { - DCHECK_NE(g_browser_process, nullptr); - PrefService* local_state = g_browser_process->local_state(); - DCHECK_NE(local_state, nullptr); - local_state->ClearPref(prefs::kSwReporterLastTimeSentReport); - } - // Sets local state for last time the software reporter sent logs to |days| // days ago. void SetLastTimeSentReport(int days) { SetDateInLocalState(prefs::kSwReporterLastTimeSentReport, days); } + // Clears local state for last time the software reporter sent logs. This + // prevents potential false positives that could arise from state not + // properly cleaned between successive tests. + void ClearLastTimeSentReport() { + PrefService* local_state = g_browser_process->local_state(); + local_state->ClearPref(prefs::kSwReporterLastTimeSentReport); + } + + // Retrieves the timestamp of the last time the software reporter sent logs. int64_t GetLastTimeSentReport() { const PrefService* local_state = g_browser_process->local_state(); - DCHECK_NE(local_state, nullptr); DCHECK(local_state->HasPrefPath(prefs::kSwReporterLastTimeSentReport)); return local_state->GetInt64(prefs::kSwReporterLastTimeSentReport); } + void EnableSBExtendedReporting() { + Browser* browser = chrome::FindLastActive(); + DCHECK(browser); + Profile* profile = browser->profile(); + SetExtendedReportingPref(profile->GetPrefs(), true); + } + + // Expects that the reporter has been scheduled to launch again in |days| + // days. + void ExpectToRunAgain(int days) { + EXPECT_TRUE(mock_time_task_runner_->HasPendingTask()); + EXPECT_LT(base::TimeDelta::FromDays(days) - base::TimeDelta::FromHours(1), + mock_time_task_runner_->NextPendingTaskDelay()); + EXPECT_GE(base::TimeDelta::FromDays(days), + mock_time_task_runner_->NextPendingTaskDelay()); + } + + // Expects that after |days_until_launch| days, the reporter will be + // launched |expected_launch_count| times, and TriggerPrompt will be + // called if and only if |expect_prompt| is true. + void ExpectReporterLaunches(int days_until_launch, + int expected_launch_count, + bool expect_prompt) { + EXPECT_TRUE(mock_time_task_runner_->HasPendingTask()); + reporter_launch_count_ = 0; + reporter_launch_parameters_.clear(); + prompt_trigger_called_ = false; + + mock_time_task_runner_->FastForwardBy( + base::TimeDelta::FromDays(days_until_launch)); + + EXPECT_EQ(expected_launch_count, reporter_launch_count_); + EXPECT_EQ(expect_prompt, prompt_trigger_called_); + } + + // Expects that after |days_until_launched| days, the reporter will be + // launched once with each path in |expected_launch_paths|, and TriggerPrompt + // will be called if and only if |expect_prompt| is true. + void ExpectReporterLaunches( + int days_until_launch, + const std::vector<base::FilePath>& expected_launch_paths, + bool expect_prompt) { + ExpectReporterLaunches(days_until_launch, expected_launch_paths.size(), + expect_prompt); + EXPECT_EQ(expected_launch_paths.size(), reporter_launch_parameters_.size()); + for (size_t i = 0; i < expected_launch_paths.size() && + i < reporter_launch_parameters_.size(); + ++i) { + EXPECT_EQ(expected_launch_paths[i], + reporter_launch_parameters_[i].command_line.GetProgram()); + } + } + void ExpectLastTimeSentReportNotSet() { PrefService* local_state = g_browser_process->local_state(); - DCHECK_NE(local_state, nullptr); EXPECT_FALSE( local_state->HasPrefPath(prefs::kSwReporterLastTimeSentReport)); } void ExpectLastReportSentInTheLastHour() { const PrefService* local_state = g_browser_process->local_state(); - DCHECK_NE(local_state, nullptr); - const base::Time now = base::Time::Now(); + const base::Time now = Now(); const base::Time last_time_sent_logs = base::Time::FromInternalValue( local_state->GetInt64(prefs::kSwReporterLastTimeSentReport)); // Checks if the last time sent logs is set as no more than one hour ago, // which should be enough time if the execution does not fail. EXPECT_LT(now - base::TimeDelta::FromHours(1), last_time_sent_logs); - EXPECT_LT(last_time_sent_logs, now); + EXPECT_GE(now, last_time_sent_logs); } - // Run through the steps needed to launch the reporter, as many times as - // needed to launch all the reporters given in |expected_launch_paths|. Test - // that each of those launches succeeded. But do not test that ONLY those - // launches succeeded. - // - // After this, if more launches are expected you can call - // |TestPartialLaunchCycle| again with another list of paths, to test that - // the launch cycle will continue with those paths. - // - // To test that a list of paths are launched AND NO OTHERS, use - // |TestReporterLaunchCycle|. - void TestPartialLaunchCycle( - const std::vector<base::FilePath>& expected_launch_paths) { - // This test has an unfortunate amount of knowledge of the internals of - // ReporterRunner, because it needs to pump the right message loops at the - // right time so that all its internal messages are delivered. This - // function might need to be updated if the internals change. - // - // The basic sequence is: - // - // 1. TryToRun kicks the whole thing off. If the reporter should not be - // launched now (eg. DaysSinceLastReport is too low) it posts a call to - // itself again. (In a regular task runner this will be scheduled with a - // delay, but the test task runner ignores delays so TryToRun will be - // called again on the next call to RunPendingTasks.) - // - // 2. When it is time to run a reporter, TryToRun calls NotifyLaunchReady - // and then posts a call to LaunchAndWait. - // - // 3. When the reporter returns, a call to ReporterDone is posted on the UI - // thread. - // - // 4. ReporterDone calls NotifyReporterDone and then posts another call to - // TryToRun, which starts the whole process over for the next run. - // - // Each call to RunPendingTasks only handles messages already on the queue. - // It doesn't handle messages posted by those messages. So, we need to call - // it in a loop to make sure we're past all pending TryToRun calls before - // LaunchAndWaitForExit will be called. - // - // Once a call to LaunchAndWaitForExit has been posted, TryToRun won't be - // called again until we pump the UI message loop in order to run - // ReporterDone. - - ASSERT_TRUE(task_runner_->HasPendingTask()); - ASSERT_FALSE(reporter_done_notified_); - - reporter_launch_count_ = 0; - reporter_launch_parameters_ = SwReporterInvocation(); - - int current_launch_count = reporter_launch_count_; - for (const auto& expected_launch_path : expected_launch_paths) { - // If RunReporter was called with no pending messages, and it was already - // time to launch the reporter, then |launch_ready_notified_| will - // already be true. Otherwise there will be a TryToRun message pending, - // which must be processed first. - if (!launch_ready_notified_) { - task_runner_->RunPendingTasks(); - // Since we're expecting a launch here, we expect it to schedule - // LaunchAndWaitForExit. So NOW |launch_ready_notified_| should be - // true. - ASSERT_TRUE(task_runner_->HasPendingTask()); - } - ASSERT_TRUE(launch_ready_notified_); - ASSERT_EQ(current_launch_count, reporter_launch_count_); - - // Reset |launch_ready_notified_| so that we can tell if TryToRun gets - // called again unexpectedly. - launch_ready_notified_ = false; - - // Call the pending LaunchAndWaitForExit. - task_runner_->RunPendingTasks(); - ASSERT_FALSE(launch_ready_notified_); - ASSERT_FALSE(reporter_done_notified_); - - // At this point LaunchAndWaitForExit has definitely been called if - // it's going to be called at all. (If not, TryToRun will have been - // scheduled again.) - EXPECT_EQ(current_launch_count + 1, reporter_launch_count_); - EXPECT_EQ(expected_launch_path, - reporter_launch_parameters_.command_line.GetProgram()); - - // Pump the UI message loop to process the ReporterDone call (which - // will schedule the next TryToRun.) If LaunchAndWaitForExit wasn't - // called, this does nothing. - base::RunLoop().RunUntilIdle(); - - // At this point there are three things that could have happened: - // - // 1. LaunchAndWaitForExit was not called. There should be a TryToRun - // scheduled. - // - // 2. ReporterDone was called and there was nothing left in the queue - // of SwReporterInvocation's. There should be a TryToRun scheduled. - // - // 3. ReporterDone was called and there were more - // SwReporterInvocation's in the queue to run immediately. There should - // be a LaunchAndWaitForExit scheduled. - // - // So in all cases there should be a pending task, and if we are expecting - // more launches in this loop, |launch_ready_notified_| will already be - // true. - ASSERT_TRUE(task_runner_->HasPendingTask()); - - // The test task runner does not actually advance the clock. Pretend that - // one day has passed. (Otherwise, when we launch the last - // SwReporterInvocation in the queue, the next call to TryToRun will - // start a whole new launch cycle.) - SetDaysSinceLastReport(1); - - reporter_done_notified_ = false; - current_launch_count = reporter_launch_count_; - } - } - - // Run through the steps needed to launch the reporter, as many times as - // needed to launch all the reporters given in |expected_launch_paths|. Test - // that each of those launches succeeded. Then, run through the steps needed - // to launch the reporter again, to test that the launch cycle is complete - // (no more reporters will be launched). - void TestReporterLaunchCycle( - const std::vector<base::FilePath>& expected_launch_paths) { - TestPartialLaunchCycle(expected_launch_paths); - - // Now that all expected launches have been tested, run the cycle once more - // to make sure no more launches happen. - ASSERT_TRUE(task_runner_->HasPendingTask()); - ASSERT_FALSE(reporter_done_notified_); - ASSERT_FALSE(launch_ready_notified_); - - int current_launch_count = reporter_launch_count_; - - // Call the pending TryToRun. - task_runner_->RunPendingTasks(); - - // We expect that this scheduled another TryToRun. If it scheduled - // LaunchAndWaitForExit an unexpected launch is about to happen. - ASSERT_TRUE(task_runner_->HasPendingTask()); - ASSERT_FALSE(launch_ready_notified_); - ASSERT_FALSE(reporter_done_notified_); - ASSERT_EQ(current_launch_count, reporter_launch_count_); - } - - // Expects |reporter_launch_parameters_| to contain exactly the command line - // switches specified in |expected_switches|. - void ExpectLoggingSwitches(const std::set<std::string>& expected_switches) { + // Expects |invocation|'s command line to contain all the switches required + // for reporter logging. + void ExpectLoggingSwitches(const SwReporterInvocation& invocation, + bool expect_switches) { const base::CommandLine::SwitchMap& invocation_switches = - reporter_launch_parameters_.command_line.GetSwitches(); + invocation.command_line.GetSwitches(); + std::set<std::string> expected_switches; + if (expect_switches) + expected_switches = {std::begin(kExpectedSwitches), + std::end(kExpectedSwitches)}; EXPECT_EQ(expected_switches.size(), invocation_switches.size()); // Checks if all expected switches are in the invocation switches. It's not // necessary to check if all invocation switches are expected, since we // checked if both sets should have the same size. for (const std::string& expected_switch : expected_switches) { - EXPECT_NE(invocation_switches.find(expected_switch), - invocation_switches.end()); + EXPECT_NE(invocation_switches.end(), + invocation_switches.find(expected_switch)); } } - void EnableSBExtendedReporting() { - Browser* browser = chrome::FindLastActive(); - ASSERT_NE(browser, nullptr); - Profile* profile = browser->profile(); - ASSERT_NE(profile, nullptr); - SetExtendedReportingPref(profile->GetPrefs(), true); - } + // A task runner with a mock clock. + scoped_refptr<base::TestMockTimeTaskRunner> mock_time_task_runner_ = + new base::TestMockTimeTaskRunner(); - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; + // The task runner that was in use before installing |mock_time_task_runner_|. + scoped_refptr<base::SingleThreadTaskRunner> saved_task_runner_; + bool prompt_trigger_called_ = false; int reporter_launch_count_ = 0; - SwReporterInvocation reporter_launch_parameters_; + std::vector<SwReporterInvocation> reporter_launch_parameters_; int exit_code_to_report_ = kReporterFailureExitCode; - // This will be set to true when a call to |LaunchAndWaitForExit| is next in - // the task queue. - bool launch_ready_notified_ = false; - - bool reporter_done_notified_ = false; + // A callback to invoke when the first reporter of a queue is launched. This + // can be used to perform actions in the middle of a queue of reporters which + // all launch on the same mock clock tick. + base::OnceClosure first_launch_callback_; }; } // namespace IN_PROC_BROWSER_TEST_F(SRTFetcherTest, NothingFound) { - exit_code_to_report_ = kSwReporterNothingFound; - RunReporter(); - task_runner_->RunPendingTasks(); - EXPECT_EQ(1, reporter_launch_count_); - base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(prompt_trigger_called_); + RunReporter(kSwReporterNothingFound); + ExpectReporterLaunches(0, 1, false); ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, CleanupNeeded) { - exit_code_to_report_ = kSwReporterCleanupNeeded; - RunReporter(); - - task_runner_->RunPendingTasks(); - EXPECT_EQ(1, reporter_launch_count_); - // The reply task from the task posted to run the reporter is run on a - // specific thread, as opposed to a specific task runner, and that thread is - // the current message loop's thread. - base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(prompt_trigger_called_); + RunReporter(kSwReporterCleanupNeeded); + ExpectReporterLaunches(0, 1, true); ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, RanRecently) { constexpr int kDaysLeft = 1; - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns - kDaysLeft); - RunReporter(); - - // Here we can't run until idle since the ReporterRunner will re-post - // infinitely. - task_runner_->RunPendingTasks(); - EXPECT_EQ(0, reporter_launch_count_); - + SetDaysSinceLastTriggered(kDaysBetweenSuccessfulSwReporterRuns - kDaysLeft); + RunReporter(kSwReporterNothingFound); + ExpectReporterLaunches(0, 0, false); ExpectToRunAgain(kDaysLeft); - task_runner_->ClearPendingTasks(); + ExpectReporterLaunches(kDaysLeft, 1, false); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, WaitForBrowser) { Profile* profile = browser()->profile(); - CloseAllBrowsers(); - exit_code_to_report_ = kSwReporterCleanupNeeded; - RunReporter(); + // Ensure that even though we're closing the last browser, we don't enter the + // "shutting down" state, which will prevent the test from starting another + // browser. + ScopedKeepAlive test_keep_alive(KeepAliveOrigin::SESSION_RESTORE, + KeepAliveRestartOption::ENABLED); - task_runner_->RunPendingTasks(); + // Use the standard task runner for browser cleanup, which will wait forever + // with the mock clock. + base::MessageLoop::current()->SetTaskRunner(saved_task_runner_); + CloseBrowserSynchronously(browser()); + base::MessageLoop::current()->SetTaskRunner(mock_time_task_runner_); + ASSERT_EQ(0u, chrome::GetTotalBrowserCount()); + ASSERT_FALSE(chrome::FindLastActive()); + + // Start the reporter while the browser is closed. The prompt should not open. + RunReporter(kSwReporterCleanupNeeded); + ExpectReporterLaunches(0, 1, false); + + // Create a Browser object directly instead of using helper functions like + // CreateBrowser, because they all wait on timed events but do not advance the + // mock timer. The Browser constructor registers itself with the global + // BrowserList, which is cleaned up when InProcessBrowserTest exits. + new Browser(Browser::CreateParams(profile, /*user_gesture=*/false)); + ASSERT_EQ(1u, chrome::GetTotalBrowserCount()); + + // Some browser startup tasks are scheduled to run in the first few minutes + // after creation. Make sure they've all been processed so that the only + // pending task in the queue is the next reporter check. + mock_time_task_runner_->FastForwardBy(base::TimeDelta::FromMinutes(10)); + + // On opening the new browser, the prompt should be shown and the reporter + // should be scheduled to run later. EXPECT_EQ(1, reporter_launch_count_); - - CreateBrowser(profile); EXPECT_TRUE(prompt_trigger_called_); ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, Failure) { - exit_code_to_report_ = kReporterFailureExitCode; - RunReporter(); - - task_runner_->RunPendingTasks(); - EXPECT_EQ(1, reporter_launch_count_); - - base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(prompt_trigger_called_); + RunReporter(kReporterFailureExitCode); + ExpectReporterLaunches(0, 1, false); ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, RunDaily) { - exit_code_to_report_ = kSwReporterNothingFound; PrefService* local_state = g_browser_process->local_state(); local_state->SetBoolean(prefs::kSwReporterPendingPrompt, true); - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns - 1); - DCHECK_GT(kDaysBetweenSuccessfulSwReporterRuns - 1, + SetDaysSinceLastTriggered(kDaysBetweenSuccessfulSwReporterRuns - 1); + ASSERT_GT(kDaysBetweenSuccessfulSwReporterRuns - 1, kDaysBetweenSwReporterRunsForPendingPrompt); - RunReporter(); + RunReporter(kSwReporterNothingFound); - task_runner_->RunPendingTasks(); - EXPECT_EQ(1, reporter_launch_count_); - reporter_launch_count_ = 0; - base::RunLoop().RunUntilIdle(); + // Expect the reporter to run immediately, since a prompt is pending and it + // has been more than kDaysBetweenSwReporterRunsForPendingPrompt days. + ExpectReporterLaunches(0, 1, false); ExpectToRunAgain(kDaysBetweenSwReporterRunsForPendingPrompt); + // Move the clock ahead kDaysBetweenSwReporterRunsForPendingPrompt days. The + // expected run should trigger, but not cause the reporter to launch because + // a prompt is no longer pending. local_state->SetBoolean(prefs::kSwReporterPendingPrompt, false); - task_runner_->RunPendingTasks(); - EXPECT_EQ(0, reporter_launch_count_); - base::RunLoop().RunUntilIdle(); + ExpectReporterLaunches(kDaysBetweenSwReporterRunsForPendingPrompt, 0, false); + + // Instead it should now run kDaysBetweenSuccessfulSwReporterRuns after the + // first prompt (of which kDaysBetweenSwReporterRunsForPendingPrompt has + // already passed.) + int days_left = kDaysBetweenSuccessfulSwReporterRuns - + kDaysBetweenSwReporterRunsForPendingPrompt; + ExpectToRunAgain(days_left); + ExpectReporterLaunches(days_left, 1, false); ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ParameterChange) { - exit_code_to_report_ = kSwReporterNothingFound; - // If the reporter is run several times with different parameters, it should // only be launched once, with the last parameter set. const base::FilePath path1(L"path1"); @@ -432,29 +379,27 @@ constexpr int kDaysLeft = 1; { SCOPED_TRACE("N days left until next reporter run"); - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns - kDaysLeft); - RunReporter(path1); - TestReporterLaunchCycle({}); + SetDaysSinceLastTriggered(kDaysBetweenSuccessfulSwReporterRuns - kDaysLeft); + RunReporter(kSwReporterNothingFound, path1); + ExpectReporterLaunches(0, {}, false); } // Schedule path2 just as we enter the next reporting period. // Now the reporter should launch, just once, using path2. { SCOPED_TRACE("Reporter runs now"); - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - RunReporter(path2); + RunReporter(kSwReporterNothingFound, path2); // Schedule it twice; it should only actually run once. - RunReporter(path2); - TestReporterLaunchCycle({path2}); + RunReporter(kSwReporterNothingFound, path2); + ExpectReporterLaunches(kDaysLeft, {path2}, false); } // Schedule path3 before any more time has passed. // The reporter should not launch. { SCOPED_TRACE("No more time passed"); - SetDaysSinceLastReport(0); - RunReporter(path3); - TestReporterLaunchCycle({}); + RunReporter(kSwReporterNothingFound, path3); + ExpectReporterLaunches(0, {}, false); } // Enter the next reporting period as path3 is still scheduled. @@ -462,8 +407,8 @@ // parameters from the first launch aren't reused.) { SCOPED_TRACE("Previous run still scheduled"); - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - TestReporterLaunchCycle({path3}); + ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path3}, + false); } // Schedule path3 again in the next reporting period. @@ -471,15 +416,15 @@ // passed, even though the parameters haven't changed. { SCOPED_TRACE("Run with same parameters"); - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - RunReporter(path3); - TestReporterLaunchCycle({path3}); + RunReporter(kSwReporterNothingFound, path3); + ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path3}, + false); } + + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, MultipleLaunches) { - exit_code_to_report_ = kSwReporterNothingFound; - const base::FilePath path1(L"path1"); const base::FilePath path2(L"path2"); const base::FilePath path3(L"path3"); @@ -490,100 +435,99 @@ { SCOPED_TRACE("Launch 2 times"); - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - RunReporterQueue(invocations); - TestReporterLaunchCycle({path1, path2}); + SetDaysSinceLastTriggered(kDaysBetweenSuccessfulSwReporterRuns); + RunReporterQueue(kSwReporterNothingFound, invocations); + ExpectReporterLaunches(0, {path1, path2}, false); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } // Schedule a launch with 2 elements, then another with the same 2. It should // just run 2 times, not 4. { SCOPED_TRACE("Launch 2 times with retry"); - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - RunReporterQueue(invocations); - RunReporterQueue(invocations); - TestReporterLaunchCycle({path1, path2}); + RunReporterQueue(kSwReporterNothingFound, invocations); + RunReporterQueue(kSwReporterNothingFound, invocations); + ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path1, path2}, + false); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } - // Schedule a launch with 2 elements, then add a third while the queue is - // running. + // Another launch with 2 elements is already scheduled. Add a third while the + // queue is running. { SCOPED_TRACE("Add third launch while running"); - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - RunReporterQueue(invocations); - - // Only test the cycle once, to process the first element in queue. - TestPartialLaunchCycle({path1}); - invocations.push(SwReporterInvocation::FromFilePath(path3)); - RunReporterQueue(invocations); + first_launch_callback_ = base::BindOnce( + &SRTFetcherTest::RunReporterQueue, base::Unretained(this), + kSwReporterNothingFound, invocations); - // There is still a 2nd element on the queue - that should execute, and - // nothing more. - TestReporterLaunchCycle({path2}); + // Only the first two elements should execute since the third was added + // during the cycle. + ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path1, path2}, + false); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); // Time passes... Now the 3-element queue should run. - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - TestReporterLaunchCycle({path1, path2, path3}); + ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, + {path1, path2, path3}, false); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } // Second launch should not occur after a failure. { SCOPED_TRACE("Launch multiple times with failure"); - exit_code_to_report_ = kReporterFailureExitCode; - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - RunReporterQueue(invocations); - TestReporterLaunchCycle({path1}); + RunReporterQueue(kReporterFailureExitCode, invocations); + ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path1}, + false); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); // If we try again before the reporting period is up, it should not do // anything. - TestReporterLaunchCycle({}); + ExpectReporterLaunches(0, {}, false); // After enough time has passed, should try the queue again. - SetDaysSinceLastReport(kDaysBetweenSuccessfulSwReporterRuns); - TestReporterLaunchCycle({path1}); + ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path1}, + false); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_NoSBExtendedReporting) { - exit_code_to_report_ = kSwReporterNothingFound; base::test::ScopedFeatureList scoped_feature_list; - RunReporter(); - TestReporterLaunchCycle({base::FilePath()}); - ExpectLoggingSwitches({/*expect no switches*/}); + RunReporter(kSwReporterNothingFound); + ExpectReporterLaunches(0, 1, false); + ExpectLoggingSwitches(reporter_launch_parameters_.front(), false); ExpectLastTimeSentReportNotSet(); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_EnabledFirstRun) { - exit_code_to_report_ = kSwReporterNothingFound; base::test::ScopedFeatureList scoped_feature_list; EnableSBExtendedReporting(); // Note: don't set last time sent logs in the local state. // SBER is enabled and there is no record in the local state of the last time // logs have been sent, so we should send logs in this run. - RunReporter(); - TestReporterLaunchCycle({base::FilePath()}); - ExpectLoggingSwitches(std::set<std::string>(std::begin(kExpectedSwitches), - std::end(kExpectedSwitches))); + RunReporter(kSwReporterNothingFound); + ExpectReporterLaunches(0, 1, false); + ExpectLoggingSwitches(reporter_launch_parameters_.front(), true); ExpectLastReportSentInTheLastHour(); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_EnabledNoRecentLogging) { - exit_code_to_report_ = kSwReporterNothingFound; base::test::ScopedFeatureList scoped_feature_list; // SBER is enabled and last time logs were sent was more than // |kDaysBetweenReporterLogsSent| day ago, so we should send logs in this run. EnableSBExtendedReporting(); SetLastTimeSentReport(kDaysBetweenReporterLogsSent + 3); - RunReporter(); - TestReporterLaunchCycle({base::FilePath()}); - ExpectLoggingSwitches(std::set<std::string>(std::begin(kExpectedSwitches), - std::end(kExpectedSwitches))); + RunReporter(kSwReporterNothingFound); + ExpectReporterLaunches(0, 1, false); + ExpectLoggingSwitches(reporter_launch_parameters_.front(), true); ExpectLastReportSentInTheLastHour(); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_EnabledRecentlyLogged) { - exit_code_to_report_ = kSwReporterNothingFound; base::test::ScopedFeatureList scoped_feature_list; // SBER is enabled, but logs have been sent less than // |kDaysBetweenReporterLogsSent| day ago, so we shouldn't send any logs in @@ -591,14 +535,14 @@ EnableSBExtendedReporting(); SetLastTimeSentReport(kDaysBetweenReporterLogsSent - 1); int64_t last_time_sent_logs = GetLastTimeSentReport(); - RunReporter(); - TestReporterLaunchCycle({base::FilePath()}); - ExpectLoggingSwitches(std::set<std::string>{/*expect no switches*/}); + RunReporter(kSwReporterNothingFound); + ExpectReporterLaunches(0, 1, false); + ExpectLoggingSwitches(reporter_launch_parameters_.front(), false); EXPECT_EQ(last_time_sent_logs, GetLastTimeSentReport()); + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_MultipleLaunches) { - exit_code_to_report_ = kSwReporterNothingFound; base::test::ScopedFeatureList scoped_feature_list; EnableSBExtendedReporting(); SetLastTimeSentReport(kDaysBetweenReporterLogsSent + 3); @@ -612,27 +556,27 @@ SwReporterInvocation::BEHAVIOUR_ALLOW_SEND_REPORTER_LOGS; invocations.push(invocation); } - RunReporterQueue(invocations); + RunReporterQueue(kSwReporterNothingFound, invocations); // SBER is enabled and last time logs were sent was more than // |kDaysBetweenReporterLogsSent| day ago, so we should send logs in this run. { SCOPED_TRACE("first launch"); - TestPartialLaunchCycle({path1}); - ExpectLoggingSwitches(std::set<std::string>(std::begin(kExpectedSwitches), - std::end(kExpectedSwitches))); - ExpectLastReportSentInTheLastHour(); + first_launch_callback_ = + base::BindOnce(&SRTFetcherTest::ExpectLastReportSentInTheLastHour, + base::Unretained(this)); + ExpectReporterLaunches(0, {path1, path2}, false); + ExpectLoggingSwitches(reporter_launch_parameters_[0], true); } // Logs should also be sent for the next run, even though LastTimeSentReport // is now recent, because the run is part of the same set of invocations. { SCOPED_TRACE("second launch"); - TestReporterLaunchCycle({path2}); - ExpectLoggingSwitches(std::set<std::string>(std::begin(kExpectedSwitches), - std::end(kExpectedSwitches))); + ExpectLoggingSwitches(reporter_launch_parameters_[1], true); ExpectLastReportSentInTheLastHour(); } + ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); } } // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/srt_fetcher_win.cc b/chrome/browser/safe_browsing/srt_fetcher_win.cc index 58c8d59..58c74c9 100644 --- a/chrome/browser/safe_browsing/srt_fetcher_win.cc +++ b/chrome/browser/safe_browsing/srt_fetcher_win.cc
@@ -27,7 +27,10 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/task_runner_util.h" +#include "base/task_scheduler/post_task.h" +#include "base/task_scheduler/task_traits.h" #include "base/time/time.h" +#include "base/version.h" #include "base/win/registry.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" @@ -713,6 +716,10 @@ new SRTFetcher(profile); } +base::Time Now() { + return g_testing_delegate_ ? g_testing_delegate_->Now() : base::Time::Now(); +} + } // namespace // This class tries to run a queue of reporters and react to their exit codes. @@ -722,11 +729,8 @@ public: // Registers |invocations| to run next time |TryToRun| is scheduled. (And if // it's not already scheduled, call it now.) - static void ScheduleInvocations( - const SwReporterQueue& invocations, - const base::Version& version, - scoped_refptr<base::TaskRunner> main_thread_task_runner, - scoped_refptr<base::TaskRunner> blocking_task_runner) { + static void ScheduleInvocations(const SwReporterQueue& invocations, + const base::Version& version) { if (!instance_) { instance_ = new ReporterRunner; ANNOTATE_LEAKING_OBJECT_PTR(instance_); @@ -742,9 +746,6 @@ instance_->pending_invocations_ = invocations; instance_->version_ = version; - instance_->main_thread_task_runner_ = std::move(main_thread_task_runner); - instance_->blocking_task_runner_ = std::move(blocking_task_runner); - if (instance_->first_run_) { instance_->first_run_ = false; instance_->TryToRun(); @@ -771,20 +772,16 @@ auto next_invocation = current_invocations_.front(); current_invocations_.pop(); - if (g_testing_delegate_) - g_testing_delegate_->NotifyLaunchReady(); - AppendInvocationSpecificSwitches(&next_invocation); - // It's OK to simply |PostTaskAndReplyWithResult| so that - // |LaunchAndWaitForExit| doesn't need to access |main_thread_task_runner_| - // since the callback is not delayed and the test task runner won't need to - // force it. + base::TaskRunner* task_runner = + g_testing_delegate_ ? g_testing_delegate_->BlockingTaskRunner() + : blocking_task_runner_.get(); base::PostTaskAndReplyWithResult( - blocking_task_runner_.get(), FROM_HERE, + task_runner, FROM_HERE, base::Bind(&LaunchAndWaitForExit, next_invocation), - base::Bind(&ReporterRunner::ReporterDone, base::Unretained(this), - base::Time::Now(), version_, next_invocation)); + base::Bind(&ReporterRunner::ReporterDone, base::Unretained(this), Now(), + version_, next_invocation)); } // This method is called on the UI thread when an invocation of the reporter @@ -796,11 +793,8 @@ int exit_code) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (g_testing_delegate_) - g_testing_delegate_->NotifyReporterDone(); - - base::TimeDelta reporter_running_time = - base::Time::Now() - reporter_start_time; + base::Time now = Now(); + base::TimeDelta reporter_running_time = now - reporter_start_time; // Don't continue the current queue of reporters if one failed to launch. if (exit_code == kReporterFailureExitCode) @@ -811,7 +805,7 @@ // retrying earlier, risking running too often if it always fails, since // not many users fail here.) if (current_invocations_.empty()) { - main_thread_task_runner_->PostDelayedTask( + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), base::TimeDelta::FromDays(days_between_reporter_runs_)); @@ -839,7 +833,7 @@ local_state->SetInteger(prefs::kSwReporterLastExitCode, exit_code); } local_state->SetInt64(prefs::kSwReporterLastTimeTriggered, - base::Time::Now().ToInternalValue()); + now.ToInternalValue()); } uma.ReportRuntime(reporter_running_time); uma.ReportScanTimes(); @@ -902,7 +896,7 @@ } else { days_between_reporter_runs_ = kDaysBetweenSuccessfulSwReporterRuns; } - const base::Time now = base::Time::Now(); + const base::Time now = Now(); const base::Time last_time_triggered = base::Time::FromInternalValue( local_state->GetInt64(prefs::kSwReporterLastTimeTriggered)); const base::Time next_trigger( @@ -930,7 +924,7 @@ current_invocations_ = pending_invocations_; ScheduleNextInvocation(); } else { - main_thread_task_runner_->PostDelayedTask( + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), next_trigger - now); @@ -977,7 +971,7 @@ // state values after the reporter runs, we could send logs again too // quickly (for example, if Chrome stops before the reporter finishes). local_state->SetInt64(prefs::kSwReporterLastTimeSentReport, - base::Time::Now().ToInternalValue()); + Now().ToInternalValue()); } if (ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()) @@ -1003,8 +997,17 @@ SwReporterQueue pending_invocations_; base::Version version_; - scoped_refptr<base::TaskRunner> main_thread_task_runner_; - scoped_refptr<base::TaskRunner> blocking_task_runner_; + + scoped_refptr<base::TaskRunner> blocking_task_runner_ = + base::CreateTaskRunnerWithTraits( + // LaunchAndWaitForExit() creates (MayBlock()) and joins + // (WithBaseSyncPrimitives()) a process. + base::TaskTraits() + .WithShutdownBehavior( + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) + .WithPriority(base::TaskPriority::BACKGROUND) + .MayBlock() + .WithBaseSyncPrimitives()); // This value is used to identify how long to wait before starting a new run // of the reporter queue. It's initialized with the default value and may be @@ -1054,14 +1057,10 @@ } void RunSwReporters(const SwReporterQueue& invocations, - const base::Version& version, - scoped_refptr<base::TaskRunner> main_thread_task_runner, - scoped_refptr<base::TaskRunner> blocking_task_runner) { + const base::Version& version) { DCHECK(!invocations.empty()); DCHECK(version.IsValid()); - ReporterRunner::ScheduleInvocations(invocations, version, - std::move(main_thread_task_runner), - std::move(blocking_task_runner)); + ReporterRunner::ScheduleInvocations(invocations, version); } bool ReporterFoundUws() {
diff --git a/chrome/browser/safe_browsing/srt_fetcher_win.h b/chrome/browser/safe_browsing/srt_fetcher_win.h index c5a0f08e..95c63bda 100644 --- a/chrome/browser/safe_browsing/srt_fetcher_win.h +++ b/chrome/browser/safe_browsing/srt_fetcher_win.h
@@ -11,15 +11,13 @@ #include <queue> #include <string> -#include "base/callback_forward.h" #include "base/command_line.h" -#include "base/feature_list.h" -#include "base/memory/ref_counted.h" -#include "base/version.h" +#include "base/time/time.h" namespace base { class FilePath; class TaskRunner; +class Version; } class Browser; @@ -95,12 +93,9 @@ // queue of SwReporters to execute as a single "run". When a new try is // scheduled the entire queue is executed. // -// |version| is the version of the tool that will run. The task runners are -// provided to allow tests to provide their own. +// |version| is the version of the tool that will run. void RunSwReporters(const SwReporterQueue& invocations, - const base::Version& version, - scoped_refptr<base::TaskRunner> main_thread_task_runner, - scoped_refptr<base::TaskRunner> blocking_task_runner); + const base::Version& version); // Returns true iff Local State is successfully accessed and indicates the most // recent Reporter run terminated with an exit code indicating the presence of @@ -125,11 +120,11 @@ virtual void TriggerPrompt(Browser* browser, const std::string& reporter_version) = 0; - // Callback to let the tests know the reporter is ready to launch. - virtual void NotifyLaunchReady() = 0; + // Returns the test's idea of the current time. + virtual base::Time Now() const = 0; - // Callback to let the tests know the reporter has finished running. - virtual void NotifyReporterDone() = 0; + // A task runner used to spawn the reporter process (which blocks). + virtual base::TaskRunner* BlockingTaskRunner() const = 0; }; // Set a delegate for testing. The implementation will not take ownership of
diff --git a/chrome/browser/service_process/OWNERS b/chrome/browser/service_process/OWNERS index adb99ff8..3a21c291 100644 --- a/chrome/browser/service_process/OWNERS +++ b/chrome/browser/service_process/OWNERS
@@ -1,3 +1,5 @@ gene@chromium.org scottbyer@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/browser/sync/test/integration/sync_errors_test.cc b/chrome/browser/sync/test/integration/sync_errors_test.cc index 961af28..9e28f92e 100644 --- a/chrome/browser/sync/test/integration/sync_errors_test.cc +++ b/chrome/browser/sync/test/integration/sync_errors_test.cc
@@ -201,14 +201,8 @@ } // Tests that on receiving CLIENT_DATA_OBSOLETE sync engine gets restarted and -// initialized with different cache_guld. -// Flaky on Windows and Linux. See crbug.com/683216 -#if defined(OS_WIN) || defined(OS_LINUX) -#define MAYBE_ClientDataObsoleteTest DISABLED_ClientDataObsoleteTest -#else -#define MAYBE_ClientDataObsoleteTest ClientDataObsoleteTest -#endif -IN_PROC_BROWSER_TEST_F(SyncErrorTest, MAYBE_ClientDataObsoleteTest) { +// initialized with different cache_guid. +IN_PROC_BROWSER_TEST_F(SyncErrorTest, ClientDataObsoleteTest) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; const BookmarkNode* node1 = AddFolder(0, 0, "title1");
diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc index c929fcad..6e7b18d 100644 --- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc +++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
@@ -52,6 +52,7 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents.h" +#include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/url_constants.h" #include "content/public/test/test_renderer_host.h" #include "mojo/public/cpp/bindings/binding.h" @@ -685,6 +686,10 @@ if (TranslateService::IsTranslateBubbleEnabled()) return; + // http://crbug.com/695624 + if (content::IsBrowserSideNavigationEnabled()) + return; + SimulateNavigation(GURL("http://www.google.fr"), "fr", true); // We should have an infobar.
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index ad88173..01cd9f0 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -3484,21 +3484,25 @@ "//ui/shell_dialogs", ] - if (toolkit_views && (!is_mac || mac_views_browser)) { + if (toolkit_views) { sources += [ - "views/find_bar_host_unittest_util_views.cc", "views/payments/test_chrome_payment_request_delegate.cc", "views/payments/test_chrome_payment_request_delegate.h", - "views/toolbar/browser_action_test_util_views.cc", ] - if (!is_mac) { - deps += [ "//ui/aura" ] + if (!is_mac || mac_views_browser) { + sources += [ + "views/find_bar_host_unittest_util_views.cc", + "views/toolbar/browser_action_test_util_views.cc", + ] + if (!is_mac) { + deps += [ "//ui/aura" ] + } + } else { + sources += [ + "cocoa/extensions/browser_action_test_util_mac.mm", + "cocoa/find_bar/find_bar_host_unittest_util_cocoa.mm", + ] } - } else { - sources += [ - "cocoa/extensions/browser_action_test_util_mac.mm", - "cocoa/find_bar/find_bar_host_unittest_util_cocoa.mm", - ] } if (!is_android) {
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc index d30eb2d..c454ba5 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
@@ -128,24 +128,18 @@ public: AnimationSetter(aura::Window* window, int animation_time_in_ms) : window_(window), - previous_animation_type_( - wm::GetWindowVisibilityAnimationType(window_)), + previous_animation_type_(wm::GetWindowVisibilityAnimationType(window_)), previous_animation_time_( wm::GetWindowVisibilityAnimationDuration(*window_)) { wm::SetWindowVisibilityAnimationType( - window_, - wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); + window_, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); wm::SetWindowVisibilityAnimationDuration( - window_, - base::TimeDelta::FromMilliseconds(animation_time_in_ms)); + window_, base::TimeDelta::FromMilliseconds(animation_time_in_ms)); } ~AnimationSetter() { - wm::SetWindowVisibilityAnimationType(window_, - previous_animation_type_); - wm::SetWindowVisibilityAnimationDuration( - window_, - previous_animation_time_); + wm::SetWindowVisibilityAnimationType(window_, previous_animation_type_); + wm::SetWindowVisibilityAnimationDuration(window_, previous_animation_time_); } private:
diff --git a/chrome/browser/ui/cocoa/OWNERS b/chrome/browser/ui/cocoa/OWNERS index 19ce7ba..2b2fecee 100644 --- a/chrome/browser/ui/cocoa/OWNERS +++ b/chrome/browser/ui/cocoa/OWNERS
@@ -1,6 +1,7 @@ asvitkine@chromium.org avi@chromium.org ccameron@chromium.org +ellyjones@chromium.org groby@chromium.org mark@chromium.org rohitrao@chromium.org
diff --git a/chrome/browser/ui/cocoa/browser_window_touch_bar.mm b/chrome/browser/ui/cocoa/browser_window_touch_bar.mm index 21de9b4a..d812ab1 100644 --- a/chrome/browser/ui/cocoa/browser_window_touch_bar.mm +++ b/chrome/browser/ui/cocoa/browser_window_touch_bar.mm
@@ -25,7 +25,7 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia_util_mac.h" #include "ui/gfx/paint_vector_icon.h" -#include "ui/native_theme/native_theme.h" +#include "ui/gfx/vector_icons_public.h" #include "ui/vector_icons/vector_icons.h" namespace { @@ -38,8 +38,8 @@ const NSTouchBarItemIdentifier kBackForwardTouchId = @"BackForwardTouchId"; const NSTouchBarItemIdentifier kReloadOrStopTouchId = @"ReloadOrStopTouchId"; const NSTouchBarItemIdentifier kSearchTouchId = @"SearchTouchId"; -const NSTouchBarItemIdentifier kNewTabTouchId = @"NewTabTouchId"; const NSTouchBarItemIdentifier kStarTouchId = @"StarTouchId"; +const NSTouchBarItemIdentifier kNewTabTouchId = @"NewTabTouchId"; // The button indexes in the back and forward segment control. const int kBackSegmentIndex = 0; @@ -47,6 +47,7 @@ // Touch bar icon colors values. const SkColor kTouchBarDefaultIconColor = SK_ColorWHITE; +const SkColor kTouchBarStarActiveColor = gfx::kGoogleBlue500; // The size of the touch bar icons. const int kTouchBarIconSize = 16; @@ -114,8 +115,8 @@ base::scoped_nsobject<NSTouchBar> touchBar( [[NSClassFromString(@"NSTouchBar") alloc] init]); NSArray* touchBarItemIdentifiers = @[ - kBackForwardTouchId, kReloadOrStopTouchId, kSearchTouchId, kNewTabTouchId, - kStarTouchId + kBackForwardTouchId, kReloadOrStopTouchId, kSearchTouchId, kStarTouchId, + kNewTabTouchId ]; [touchBar setCustomizationIdentifier:kBrowserWindowTouchBarId]; [touchBar setDefaultItemIdentifiers:touchBarItemIdentifiers]; @@ -143,13 +144,10 @@ [touchBarItem setView:CreateTouchBarButton(kNewTabMacTouchbarIcon, self, IDC_NEW_TAB)]; } else if ([identifier isEqualTo:kStarTouchId]) { - const SkColor kStarredIconColor = - ui::NativeTheme::GetInstanceForNativeUi()->GetSystemColor( - ui::NativeTheme::kColorId_ProminentButtonColor); const gfx::VectorIcon& icon = isStarred_ ? toolbar::kStarActiveIcon : toolbar::kStarIcon; SkColor iconColor = - isStarred_ ? kStarredIconColor : kTouchBarDefaultIconColor; + isStarred_ ? kTouchBarStarActiveColor : kTouchBarDefaultIconColor; [touchBarItem setView:CreateTouchBarButton(icon, self, IDC_BOOKMARK_PAGE, iconColor)]; } else if ([identifier isEqualTo:kSearchTouchId]) { @@ -179,12 +177,32 @@ } - (NSView*)searchTouchBarView { - // TODO(spqchan): Use the Google search icon if the default search engine is - // Google. - base::string16 title = l10n_util::GetStringUTF16(IDS_TOUCH_BAR_SEARCH); + TemplateURLService* templateUrlService = + TemplateURLServiceFactory::GetForProfile(browser_->profile()); + const TemplateURL* defaultProvider = + templateUrlService->GetDefaultSearchProvider(); + BOOL isGoogle = + defaultProvider->GetEngineType(templateUrlService->search_terms_data()) == + SEARCH_ENGINE_GOOGLE; + + base::string16 title = + isGoogle ? l10n_util::GetStringUTF16(IDS_TOUCH_BAR_GOOGLE_SEARCH) + : l10n_util::GetStringFUTF16(IDS_TOUCH_BAR_SEARCH, + defaultProvider->short_name()); + + NSImage* image; + if (isGoogle) { + image = NSImageFromImageSkiaWithColorSpace( + gfx::CreateVectorIcon(gfx::VectorIconId::GOOGLE_SEARCH_MAC_TOUCHBAR, + kTouchBarIconSize, gfx::kPlaceholderColor), + base::mac::GetSRGBColorSpace()); + } else { + image = CreateNSImageFromIcon(omnibox::kSearchIcon); + } + NSButton* searchButton = [NSButton buttonWithTitle:base::SysUTF16ToNSString(title) - image:CreateNSImageFromIcon(omnibox::kSearchIcon) + image:image target:self action:@selector(executeCommand:)]; searchButton.imageHugsTitle = YES;
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h index 8635cc0..99b9113 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
@@ -39,6 +39,10 @@ class ZoomDecoration; class ZoomDecorationTest; +namespace { +class LocationBarViewMacTest; +} + // A C++ bridge class that represents the location bar UI element to // the portable code. Wires up an OmniboxViewMac instance to // the location bar text field, which handles most of the work. @@ -215,6 +219,7 @@ std::vector<NSView*> GetDecorationAccessibilityViews(); private: + friend class LocationBarViewMacTest; friend ZoomDecorationTest; // Posts |notification| to the default notification center.
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index a4700106..47a358b 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -864,7 +864,6 @@ IsLocationBarDark()); } -// TODO(spqchan): Add tests for the security state decoration. void LocationBarViewMac::UpdateSecurityState(bool tab_changed) { using SecurityLevel = security_state::SecurityLevel; SecurityLevel new_security_level = GetToolbarModel()->GetSecurityLevel(false); @@ -879,18 +878,24 @@ if ((ShouldShowSecurityState() || ShouldShowExtensionBubble() || ShouldShowChromeBubble()) && is_width_available_for_security_verbose_) { - bool is_secure_to_secure = IsSecureConnection(new_security_level) && - IsSecureConnection(security_level_); - bool is_new_security_level = - security_level_ != new_security_level && !is_secure_to_secure; - if (!tab_changed && security_state_bubble_decoration_->HasAnimatedOut()) - security_state_bubble_decoration_->AnimateIn(false); - else if (tab_changed || !CanAnimateSecurityLevel(new_security_level)) + if (tab_changed) { security_state_bubble_decoration_->ShowWithoutAnimation(); - else if (is_new_security_level) - security_state_bubble_decoration_->AnimateIn(); + } else { + bool is_secure_to_secure = IsSecureConnection(new_security_level) && + IsSecureConnection(security_level_); + bool is_new_security_level = + security_level_ != new_security_level && !is_secure_to_secure; + if (!is_new_security_level && + security_state_bubble_decoration_->HasAnimatedOut()) { + security_state_bubble_decoration_->AnimateIn(false); + } else if (!CanAnimateSecurityLevel(new_security_level)) { + security_state_bubble_decoration_->ShowWithoutAnimation(); + } else if (is_new_security_level) { + security_state_bubble_decoration_->AnimateIn(); + } + } } else if (!is_width_available_for_security_verbose_ || - CanAnimateSecurityLevel(security_level_)) { + (!tab_changed && CanAnimateSecurityLevel(security_level_))) { security_state_bubble_decoration_->AnimateOut(); } @@ -900,8 +905,8 @@ bool LocationBarViewMac::CanAnimateSecurityLevel( security_state::SecurityLevel level) const { return !GetOmniboxView()->IsEditingOrEmpty() && - (security_level_ == security_state::SecurityLevel::DANGEROUS || - security_level_ == security_state::SecurityLevel::HTTP_SHOW_WARNING); + (level == security_state::DANGEROUS || + level == security_state::HTTP_SHOW_WARNING); } bool LocationBarViewMac::IsSecureConnection(
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac_unittest.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac_unittest.mm new file mode 100644 index 0000000..e44792d --- /dev/null +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac_unittest.mm
@@ -0,0 +1,354 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" + +#import <Cocoa/Cocoa.h> + +#include "base/macros.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_command_controller.h" +#include "chrome/browser/ui/browser_window.h" +#import "chrome/browser/ui/cocoa/browser_window_controller.h" +#import "chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h" +#include "chrome/browser/ui/cocoa/test/cocoa_profile_test.h" +#include "components/toolbar/test_toolbar_model.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +// Mocks the OmniboxView so that we can set if the omnibox is empty or not. +class MockOmniboxView : public OmniboxViewMac { + public: + MockOmniboxView(OmniboxEditController* controller, + Profile* profile, + CommandUpdater* command_updater, + AutocompleteTextField* field) + : OmniboxViewMac(controller, profile, command_updater, field) {} + + // Sets if the MockOmniboxView should be empty or not. + void set_is_empty(bool is_empty) { is_empty_ = is_empty; } + + // Returns 0 if |is_empty_| is false. Otherwise, return 1. + int GetOmniboxTextLength() const override { return is_empty_ ? 0 : 1; } + + private: + // True if the OmniboxView should be empty. + bool is_empty_ = false; + + DISALLOW_COPY_AND_ASSIGN(MockOmniboxView); +}; + +// Testing class for LocationBarViewMac. This class is used mock the +// ToolbarModel. +class TestingLocationBarViewMac : public LocationBarViewMac { + public: + TestingLocationBarViewMac(AutocompleteTextField* field, + CommandUpdater* command_updater, + Profile* profile, + Browser* browser) + : LocationBarViewMac(field, command_updater, profile, browser) {} + + // Overridden so that LocationBarViewMac will use the test ToolbarModel + // instead. + const ToolbarModel* GetToolbarModel() const override { + return &toolbar_model_; + } + + // Overridden so that LocationBarViewMac will use the test ToolbarModel + // instead. + ToolbarModel* GetToolbarModel() override { return &toolbar_model_; } + + // Sets the security level of |toolbar_model_|. + void SetSecurityLevel(security_state::SecurityLevel level) { + toolbar_model_.set_security_level(level); + } + + private: + // The toolbar model used for testing. + TestToolbarModel toolbar_model_; + + DISALLOW_COPY_AND_ASSIGN(TestingLocationBarViewMac); +}; + +// Testing class for TestingSecurityStateBubbleDecoration. +class TestingSecurityStateBubbleDecoration + : public SecurityStateBubbleDecoration { + public: + TestingSecurityStateBubbleDecoration(LocationIconDecoration* location_icon, + LocationBarViewMac* owner) + : SecurityStateBubbleDecoration(location_icon, owner) {} + + void AnimateIn(bool image_fade = true) override { + has_animated_ = true; + is_showing_ = true; + SecurityStateBubbleDecoration::AnimateIn(image_fade); + } + + void AnimateOut() override { + has_animated_ = true; + is_showing_ = false; + SecurityStateBubbleDecoration::AnimateOut(); + } + + void ShowWithoutAnimation() override { + is_showing_ = true; + has_animated_ = false; + SecurityStateBubbleDecoration::ShowWithoutAnimation(); + } + + void ResetAnimation() override { + is_showing_ = false; + has_animated_ = false; + SecurityStateBubbleDecoration::ResetAnimation(); + } + + bool has_animated() const { return has_animated_; }; + + bool is_showing() const { return is_showing_; }; + + void ResetAnimationFlag() { has_animated_ = false; } + + private: + // True if the decoration has animated. + bool has_animated_ = false; + + // True if the decoration is showing. + bool is_showing_ = false; + + DISALLOW_COPY_AND_ASSIGN(TestingSecurityStateBubbleDecoration); +}; + +class LocationBarViewMacTest : public CocoaProfileTest { + public: + void SetUp() override { + CocoaProfileTest::SetUp(); + ASSERT_TRUE(browser()); + + // Width must be large, otherwise it'll be too narrow to fit the security + // state decoration. + NSRect frame = NSMakeRect(0, 0, 500, 30); + field_.reset([[AutocompleteTextField alloc] initWithFrame:frame]); + + location_bar_.reset(new TestingLocationBarViewMac( + field_.get(), browser()->command_controller()->command_updater(), + browser()->profile(), browser())); + + location_bar_->security_state_bubble_decoration_.reset( + new TestingSecurityStateBubbleDecoration( + location_bar_->location_icon_decoration_.get(), + location_bar_.get())); + decoration()->disable_animations_during_testing_ = true; + + omnibox_view_ = new MockOmniboxView( + nullptr, browser()->profile(), + browser()->command_controller()->command_updater(), field_.get()); + + location_bar_->omnibox_view_.reset(omnibox_view_); + } + + void TearDown() override { + location_bar_.reset(); + CocoaProfileTest::TearDown(); + } + + TestingSecurityStateBubbleDecoration* decoration() const { + TestingSecurityStateBubbleDecoration* decoration = + static_cast<TestingSecurityStateBubbleDecoration*>( + location_bar_->security_state_bubble_decoration_.get()); + + return decoration; + } + + TestingLocationBarViewMac* location_bar() const { + return location_bar_.get(); + } + + MockOmniboxView* omnibox_view() const { + MockOmniboxView* omnibox_view = + static_cast<MockOmniboxView*>(location_bar_->omnibox_view_.get()); + return omnibox_view; + } + + AutocompleteTextField* field() const { return field_.get(); } + + void UpdateSecurityState(bool tab_changed) { + location_bar_->Layout(); + location_bar_->UpdateSecurityState(tab_changed); + } + + protected: + LocationBarViewMacTest() {} + + private: + // The LocationBarView object we're testing. + std::unique_ptr<TestingLocationBarViewMac> location_bar_; + + // The autocomplete text field. + base::scoped_nsobject<AutocompleteTextField> field_; + + // The mocked omnibox view. Weak, owned by |location_bar_|. + MockOmniboxView* omnibox_view_; + + DISALLOW_COPY_AND_ASSIGN(LocationBarViewMacTest); +}; + +// Tests the security decoration's visibility and animation without any tab or +// width changes. +TEST_F(LocationBarViewMacTest, ShowAndAnimateSecurityDecoration) { + // Set the security level to DANGEROUS. The decoration should animate in. + location_bar()->SetSecurityLevel(security_state::DANGEROUS); + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Set the security level to NONE. The decoration should animate out. + location_bar()->SetSecurityLevel(security_state::NONE); + UpdateSecurityState(false); + EXPECT_FALSE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Set the security level to SECURE. The decoration should show, but not + // animate. + location_bar()->SetSecurityLevel(security_state::SECURE); + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Set the security level to EV_SECURE. The decoration should still show, + // but not animate. + location_bar()->SetSecurityLevel(security_state::EV_SECURE); + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Set the security level to NONE. The decoration should still hide without + // animating out. + location_bar()->SetSecurityLevel(security_state::NONE); + UpdateSecurityState(false); + EXPECT_FALSE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); +} + +// Tests the security decoration's visibility and animation when the omnibox +// is updated from a switched tab. +TEST_F(LocationBarViewMacTest, SecurityDecorationWithTabChanges) { + // Show nonsecure decoration. + location_bar()->SetSecurityLevel(security_state::HTTP_SHOW_WARNING); + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Switch to a tab with no decoration. + location_bar()->SetSecurityLevel(security_state::NONE); + UpdateSecurityState(true); + EXPECT_FALSE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Switch back to the tab with the nonsecure decoration. + location_bar()->SetSecurityLevel(security_state::HTTP_SHOW_WARNING); + UpdateSecurityState(true); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Show the secure decoration. + location_bar()->SetSecurityLevel(security_state::SECURE); + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Switch to a tab with no decoration. + location_bar()->SetSecurityLevel(security_state::NONE); + UpdateSecurityState(true); + EXPECT_FALSE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); +} + +// Tests the security decoration's visibility and animation when the omnibox +// is empty. +TEST_F(LocationBarViewMacTest, SecurityDecorationWithEmptyOmnibox) { + // Set the omnibox to empty and then set the security level to nonsecure. + // The decoration should not appear. + omnibox_view()->set_is_empty(true); + location_bar()->SetSecurityLevel(security_state::HTTP_SHOW_WARNING); + UpdateSecurityState(false); + EXPECT_FALSE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Set the omnibox to nonempty. The decoration should now appear. + omnibox_view()->set_is_empty(false); + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); +} + +// Tests to see that the security decoration animates out when the omnibox's +// width becomes narrow. +TEST_F(LocationBarViewMacTest, SecurityDecorationWidthChanges) { + // Show the nonsecure decoration. + location_bar()->SetSecurityLevel(security_state::HTTP_SHOW_WARNING); + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Make the omnibox narrow. + [field() setFrame:NSMakeRect(0, 0, 119, 30)]; + UpdateSecurityState(false); + EXPECT_FALSE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Make the omnibox wide again. + [field() setFrame:NSMakeRect(0, 0, 500, 30)]; + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Show secure decoration. + location_bar()->SetSecurityLevel(security_state::SECURE); + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_FALSE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Make the omnibox narrow. + [field() setFrame:NSMakeRect(0, 0, 119, 30)]; + UpdateSecurityState(false); + EXPECT_FALSE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); + + decoration()->ResetAnimationFlag(); + + // Make the omnibox wide again. + [field() setFrame:NSMakeRect(0, 0, 500, 30)]; + UpdateSecurityState(false); + EXPECT_TRUE(decoration()->is_showing()); + EXPECT_TRUE(decoration()->has_animated()); +} + +} // namespace
diff --git a/chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h b/chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h index ebb37c54..052d039 100644 --- a/chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h +++ b/chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h
@@ -25,6 +25,10 @@ class SecurityStateBubbleDecorationTest; } +namespace { +class LocationBarViewMacTest; +} + class SecurityStateBubbleDecoration : public BubbleDecoration, public gfx::AnimationDelegate { public: @@ -39,12 +43,12 @@ // Set the color of the label. void SetLabelColor(SkColor color); - // Methods that animate in and out the chip. - void AnimateIn(bool image_fade = true); - void AnimateOut(); + // Methods that animate in and out the chip. Virtual for testing. + virtual void AnimateIn(bool image_fade = true); + virtual void AnimateOut(); - // Shows the chip without animation. - void ShowWithoutAnimation(); + // Shows the chip without animation. Virtual for testing. + virtual void ShowWithoutAnimation(); // Returns true if the chip has fully animated in. bool HasAnimatedIn() const; @@ -55,8 +59,8 @@ // Returns true if the chip is in the process of animating out. bool AnimatingOut() const; - // Resets the animation. - void ResetAnimation(); + // Resets the animation. Virtual for testing. + virtual void ResetAnimation(); // LocationBarDecoration: CGFloat GetWidthForSpace(CGFloat width) override; @@ -81,6 +85,7 @@ NSColor* GetDarkModeTextColor() override; private: + friend class ::LocationBarViewMacTest; friend class ::SecurityStateBubbleDecorationTest; // Returns the animation progress. If not in MD, the animation progress
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index f4f3f71..de28b7a 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
@@ -833,12 +833,13 @@ if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { CGFloat leftEdge = NSMinX([locationBar_ frame]); if ([browserActionsContainerView_ isHidden]) { - delta = leftEdge - NSMaxX([appMenuButton_ frame]) + - [ToolbarController appMenuPadding] + kButtonInset; + delta = leftEdge - + (NSMaxX([appMenuButton_ frame]) + + [ToolbarController appMenuPadding] + kButtonInset); } else { delta = leftEdge - - NSMaxX([browserActionsContainerView_ animationEndFrame]) + - kButtonInset; + (NSMaxX([browserActionsContainerView_ animationEndFrame]) + + kButtonInset); } } else { CGFloat rightEdge = NSMaxX([locationBar_ frame]);
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index 889ec1b..3116c947 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -588,6 +588,11 @@ LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)); } +int ChromeViewsDelegate::GetButtonMinimumWidth() const { + return LayoutDelegate::Get()->GetMetric( + LayoutDelegate::Metric::BUTTON_MINIMUM_WIDTH); +} + int ChromeViewsDelegate::GetDialogButtonMinimumWidth() const { return LayoutDelegate::Get()->GetMetric( LayoutDelegate::Metric::DIALOG_BUTTON_MINIMUM_WIDTH);
diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h index c45f974..c86cf03e 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.h +++ b/chrome/browser/ui/views/chrome_views_delegate.h
@@ -68,6 +68,7 @@ int GetDialogRelatedControlVerticalSpacing() const override; gfx::Insets GetDialogFrameViewInsets() const override; gfx::Insets GetBubbleDialogMargins() const override; + int GetButtonMinimumWidth() const override; int GetDialogButtonMinimumWidth() const override; int GetButtonHorizontalPadding() const override;
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index a94c2b7..5472d4b 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -64,9 +64,6 @@ const int kTreeViewWidth = 400; const int kTreeViewHeight = 125; -// The color of the border around the cookies tree view. -const SkColor kCookiesBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); - // Spacing constants used with non-Harmony dialogs. const int kTabbedPaneTopPadding = 14; const int kCookieInfoBottomPadding = 4; @@ -489,9 +486,9 @@ } views::View* CollectedCookiesViews::CreateScrollView(views::TreeView* pane) { - views::ScrollView* scroll_view = new views::ScrollView(); + views::ScrollView* scroll_view = + views::ScrollView::CreateScrollViewWithBorder(); scroll_view->SetContents(pane); - scroll_view->SetBorder(views::CreateSolidBorder(1, kCookiesBorderColor)); return scroll_view; }
diff --git a/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc index 45cb24b..fa98a1c 100644 --- a/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc +++ b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc
@@ -21,6 +21,7 @@ return kHarmonyLayoutUnit; case Metric::DIALOG_BUTTON_MARGIN: return kHarmonyLayoutUnit; + case Metric::BUTTON_MINIMUM_WIDTH: case Metric::DIALOG_BUTTON_MINIMUM_WIDTH: // Minimum label size plus padding. return 2 * kHarmonyLayoutUnit +
diff --git a/chrome/browser/ui/views/harmony/layout_delegate.cc b/chrome/browser/ui/views/harmony/layout_delegate.cc index d366297d..1f80b87 100644 --- a/chrome/browser/ui/views/harmony/layout_delegate.cc +++ b/chrome/browser/ui/views/harmony/layout_delegate.cc
@@ -23,7 +23,9 @@ int LayoutDelegate::GetMetric(Metric metric) const { switch (metric) { case Metric::BUTTON_HORIZONTAL_PADDING: - return 0; + return views::kButtonHorizontalPadding; + case Metric::BUTTON_MINIMUM_WIDTH: + return views::kMinimumButtonWidth; case Metric::DIALOG_BUTTON_MARGIN: return views::kButtonHEdgeMarginNew; case Metric::DIALOG_BUTTON_MINIMUM_WIDTH:
diff --git a/chrome/browser/ui/views/harmony/layout_delegate.h b/chrome/browser/ui/views/harmony/layout_delegate.h index 4f39146e..9841b67c 100644 --- a/chrome/browser/ui/views/harmony/layout_delegate.h +++ b/chrome/browser/ui/views/harmony/layout_delegate.h
@@ -12,6 +12,8 @@ enum class Metric { // Padding on the left and right side of a button's label. BUTTON_HORIZONTAL_PADDING, + // Default minimum width of a button. + BUTTON_MINIMUM_WIDTH, // Margin between the edge of a dialog and the left, right, or bottom of a // contained button. DIALOG_BUTTON_MARGIN,
diff --git a/chrome/browser/ui/views/payments/OWNERS b/chrome/browser/ui/views/payments/OWNERS index 2c67acd..40501f2 100644 --- a/chrome/browser/ui/views/payments/OWNERS +++ b/chrome/browser/ui/views/payments/OWNERS
@@ -1,2 +1,4 @@ anthonyvd@chromium.org rouslan@chromium.org + +# COMPONENT: UI>Browser>Autofill>Payments
diff --git a/chrome/browser/ui/webui/OWNERS b/chrome/browser/ui/webui/OWNERS index df3d93f..016c0a8 100644 --- a/chrome/browser/ui/webui/OWNERS +++ b/chrome/browser/ui/webui/OWNERS
@@ -29,6 +29,7 @@ per-file snippets_internals*=file://components/ntp_snippets/OWNERS per-file ntp_tiles_internals_ui.*=file://components/ntp_tiles/OWNERS per-file popular_sites_internals_ui.*=file://components/ntp_tiles/OWNERS +per-file net_export_ui.*=file://net/OWNERS # Maintaining ownership from this file's original Chrome OS location. per-file device_log_ui*=stevenjb@chromium.org
diff --git a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h index 8cabf78..6419629 100644 --- a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h
@@ -9,7 +9,7 @@ #include <string> #include "base/macros.h" -#include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_view.h" #include "chrome/browser/chromeos/login/screens/error_screen.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" @@ -19,7 +19,7 @@ // A class that handles the WebUI hooks for the app launch splash screen. class AppLaunchSplashScreenHandler : public BaseScreenHandler, - public AppLaunchSplashScreenActor, + public AppLaunchSplashScreenView, public NetworkStateInformer::NetworkStateInformerObserver { public: AppLaunchSplashScreenHandler(
diff --git a/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h index 7d02e4218..b3a759b7 100644 --- a/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h
@@ -8,7 +8,7 @@ #include <string> #include "base/macros.h" -#include "chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" namespace base { @@ -19,7 +19,7 @@ // A class that handles the WebUI hooks for the ARC kiosk splash screen. class ArcKioskSplashScreenHandler : public BaseScreenHandler, - public ArcKioskSplashScreenActor { + public ArcKioskSplashScreenView { public: ArcKioskSplashScreenHandler(); ~ArcKioskSplashScreenHandler() override; @@ -33,7 +33,7 @@ // WebUIMessageHandler implementation: void RegisterMessages() override; - // ArcKioskSplashScreenActor implementation: + // ArcKioskSplashScreenView implementation: void Show() override; void UpdateArcKioskState(ArcKioskState state) override; void SetDelegate(ArcKioskSplashScreenHandler::Delegate* delegate) override;
diff --git a/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc index 0c149ae..9622daf 100644 --- a/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc
@@ -6,7 +6,7 @@ #include "base/i18n/timezone.h" #include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h" -#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor_observer.h" +#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view_observer.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -33,7 +33,7 @@ ArcTermsOfServiceScreenHandler::~ArcTermsOfServiceScreenHandler() { system::TimezoneSettings::GetInstance()->RemoveObserver(this); for (auto& observer : observer_list_) - observer.OnActorDestroyed(this); + observer.OnViewDestroyed(this); } void ArcTermsOfServiceScreenHandler::RegisterMessages() { @@ -116,12 +116,12 @@ } void ArcTermsOfServiceScreenHandler::AddObserver( - ArcTermsOfServiceScreenActorObserver* observer) { + ArcTermsOfServiceScreenViewObserver* observer) { observer_list_.AddObserver(observer); } void ArcTermsOfServiceScreenHandler::RemoveObserver( - ArcTermsOfServiceScreenActorObserver* observer) { + ArcTermsOfServiceScreenViewObserver* observer) { observer_list_.RemoveObserver(observer); }
diff --git a/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h index bd0a1f33..f37747ee 100644 --- a/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h
@@ -11,7 +11,7 @@ #include "base/macros.h" #include "base/observer_list.h" #include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler_observer.h" -#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "chromeos/settings/timezone_settings.h" @@ -21,12 +21,12 @@ namespace chromeos { -// The sole implementation of the ArcTermsOfServiceScreenActor, using WebUI. -class ArcTermsOfServiceScreenHandler : - public BaseScreenHandler, - public ArcTermsOfServiceScreenActor, - public arc::ArcOptInPreferenceHandlerObserver, - public system::TimezoneSettings::Observer { +// The sole implementation of the ArcTermsOfServiceScreenView, using WebUI. +class ArcTermsOfServiceScreenHandler + : public BaseScreenHandler, + public ArcTermsOfServiceScreenView, + public arc::ArcOptInPreferenceHandlerObserver, + public system::TimezoneSettings::Observer { public: ArcTermsOfServiceScreenHandler(); ~ArcTermsOfServiceScreenHandler() override; @@ -38,9 +38,9 @@ void DeclareLocalizedValues( ::login::LocalizedValuesBuilder* builder) override; - // ArcTermsOfServiceScreenActor: - void AddObserver(ArcTermsOfServiceScreenActorObserver* observer) override; - void RemoveObserver(ArcTermsOfServiceScreenActorObserver* observer) override; + // ArcTermsOfServiceScreenView: + void AddObserver(ArcTermsOfServiceScreenViewObserver* observer) override; + void RemoveObserver(ArcTermsOfServiceScreenViewObserver* observer) override; void Show() override; void Hide() override; @@ -62,8 +62,7 @@ void OnBackupAndRestoreModeChanged(bool enabled, bool managed) override; void OnLocationServicesModeChanged(bool enabled, bool managed) override; - base::ObserverList<ArcTermsOfServiceScreenActorObserver, true> - observer_list_; + base::ObserverList<ArcTermsOfServiceScreenViewObserver, true> observer_list_; // Whether the screen should be shown right after initialization. bool show_on_init_ = false;
diff --git a/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc index 9bcf4f2..4c03bd98fd 100644 --- a/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc
@@ -22,7 +22,7 @@ AutoEnrollmentCheckScreenHandler::~AutoEnrollmentCheckScreenHandler() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } void AutoEnrollmentCheckScreenHandler::Show() {
diff --git a/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.h index db480ba..285fb75 100644 --- a/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.h
@@ -7,14 +7,14 @@ #include "base/compiler_specific.h" #include "base/macros.h" -#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_actor.h" +#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "content/public/browser/web_ui.h" namespace chromeos { // WebUI implementation of AutoEnrollmentCheckScreenActor. -class AutoEnrollmentCheckScreenHandler : public AutoEnrollmentCheckScreenActor, +class AutoEnrollmentCheckScreenHandler : public AutoEnrollmentCheckScreenView, public BaseScreenHandler { public: AutoEnrollmentCheckScreenHandler();
diff --git a/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc index 4446044..e77bfc9 100644 --- a/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc
@@ -36,7 +36,7 @@ ControllerPairingScreenHandler::~ControllerPairingScreenHandler() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } void ControllerPairingScreenHandler::HandleUserActed(
diff --git a/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.h index a2c3e8f..fd0c90dd 100644 --- a/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.h
@@ -6,12 +6,12 @@ #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CONTROLLER_PAIRING_SCREEN_HANDLER_H_ #include "base/macros.h" -#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" namespace chromeos { -class ControllerPairingScreenHandler : public ControllerPairingScreenActor, +class ControllerPairingScreenHandler : public ControllerPairingScreenView, public BaseScreenHandler { public: ControllerPairingScreenHandler(); @@ -36,7 +36,7 @@ void OnContextChanged(const base::DictionaryValue& diff) override; content::BrowserContext* GetBrowserContext() override; - ControllerPairingScreenActor::Delegate* delegate_ = nullptr; + ControllerPairingScreenView::Delegate* delegate_ = nullptr; bool show_on_init_ = false; DISALLOW_COPY_AND_ASSIGN(ControllerPairingScreenHandler);
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h index 1f20df68..9ec98915 100644 --- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
@@ -14,7 +14,7 @@ #include "base/values.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/login/demo_mode/demo_mode_detector.h" -#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" +#include "chrome/browser/chromeos/login/screens/core_oobe_view.h" #include "chrome/browser/chromeos/login/version_info_updater.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "ui/events/event_source.h" @@ -36,7 +36,7 @@ // The core handler for Javascript messages related to the "oobe" view. class CoreOobeHandler : public BaseScreenHandler, public VersionInfoUpdater::Delegate, - public CoreOobeActor, + public CoreOobeView, public ui::EventSource { public: class Delegate {
diff --git a/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc index 2062b454..cc8bc9e 100644 --- a/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc
@@ -23,7 +23,7 @@ DeviceDisabledScreenHandler::~DeviceDisabledScreenHandler() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } void DeviceDisabledScreenHandler::Show() {
diff --git a/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.h index 5aebbed..35a466c 100644 --- a/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.h
@@ -6,13 +6,13 @@ #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEVICE_DISABLED_SCREEN_HANDLER_H_ #include "base/macros.h" -#include "chrome/browser/chromeos/login/screens/device_disabled_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/device_disabled_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" namespace chromeos { // WebUI implementation of DeviceDisabledScreenActor. -class DeviceDisabledScreenHandler : public DeviceDisabledScreenActor, +class DeviceDisabledScreenHandler : public DeviceDisabledScreenView, public BaseScreenHandler { public: DeviceDisabledScreenHandler();
diff --git a/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc index da2f76f..ca4fcd70 100644 --- a/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc
@@ -41,7 +41,7 @@ EnableDebuggingScreenHandler::~EnableDebuggingScreenHandler() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } void EnableDebuggingScreenHandler::ShowWithParams() {
diff --git a/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h index 51a87da..30332fa 100644 --- a/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h
@@ -10,21 +10,21 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/chromeos/login/help_app_launcher.h" -#include "chrome/browser/chromeos/login/screens/enable_debugging_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/enable_debugging_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" class PrefRegistrySimple; namespace chromeos { -// WebUI implementation of EnableDebuggingScreenActor. -class EnableDebuggingScreenHandler : public EnableDebuggingScreenActor, +// WebUI implementation of EnableDebuggingScreenView. +class EnableDebuggingScreenHandler : public EnableDebuggingScreenView, public BaseScreenHandler { public: EnableDebuggingScreenHandler(); ~EnableDebuggingScreenHandler() override; - // EnableDebuggingScreenActor implementation: + // EnableDebuggingScreenView implementation: void Show() override; void Hide() override; void SetDelegate(Delegate* delegate) override;
diff --git a/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h index a329407..e2da9b4c 100644 --- a/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h
@@ -9,7 +9,7 @@ #include <string> #include "base/macros.h" -#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" +#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h" #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper.h" #include "chrome/browser/chromeos/login/screens/error_screen.h" #include "chrome/browser/chromeos/policy/enrollment_config.h" @@ -27,7 +27,7 @@ // page, such as the user pressing the signin button. class EnrollmentScreenHandler : public BaseScreenHandler, - public EnrollmentScreenActor, + public EnrollmentScreenView, public NetworkStateInformer::NetworkStateInformerObserver { public: EnrollmentScreenHandler( @@ -38,7 +38,7 @@ // Implements WebUIMessageHandler: void RegisterMessages() override; - // Implements EnrollmentScreenActor: + // Implements EnrollmentScreenView: void SetParameters(Controller* controller, const policy::EnrollmentConfig& config) override; void Show() override; @@ -119,7 +119,7 @@ const std::string& user_name, authpolicy::ErrorType code); - // Keeps the controller for this actor. + // Keeps the controller for this view. Controller* controller_ = nullptr; bool show_on_init_ = false;
diff --git a/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc index d8bcff6b..134245c 100644 --- a/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
@@ -11,7 +11,7 @@ #include "chrome/browser/chromeos/login/help_app_launcher.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/login/oobe_screen.h" -#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" +#include "chrome/browser/chromeos/login/screens/core_oobe_view.h" #include "chrome/browser/chromeos/login/screens/eula_screen.h" #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" #include "chrome/browser/chromeos/login/ui/webui_login_display.h" @@ -82,8 +82,8 @@ namespace chromeos { -EulaScreenHandler::EulaScreenHandler(CoreOobeActor* core_oobe_actor) - : core_oobe_actor_(core_oobe_actor) { +EulaScreenHandler::EulaScreenHandler(CoreOobeView* core_oobe_view) + : core_oobe_view_(core_oobe_view) { set_call_js_prefix(kJsScreenPath); } @@ -173,12 +173,12 @@ if (!page_is_ready() || !screen_) return; - core_oobe_actor_->SetUsageStats(screen_->IsUsageStatsEnabled()); + core_oobe_view_->SetUsageStats(screen_->IsUsageStatsEnabled()); // This OEM EULA is a file:// URL which we're unable to load in iframe. // Instead if it's defined we use chrome://terms/oem that will load same file. if (!screen_->GetOemEulaUrl().is_empty()) - core_oobe_actor_->SetOemEulaUrl(chrome::kChromeUITermsOemURL); + core_oobe_view_->SetOemEulaUrl(chrome::kChromeUITermsOemURL); if (show_on_init_) { Show(); @@ -187,7 +187,7 @@ } void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) { - core_oobe_actor_->SetTpmPassword(tpm_password); + core_oobe_view_->SetTpmPassword(tpm_password); } void EulaScreenHandler::HandleOnLearnMore() {
diff --git a/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h index a2031ea..14b07c1 100644 --- a/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h
@@ -19,16 +19,16 @@ namespace chromeos { -class CoreOobeActor; +class CoreOobeView; class HelpAppLauncher; -// WebUI implementation of EulaScreenActor. It is used to interact +// WebUI implementation of EulaScreenView. It is used to interact // with the eula part of the JS page. class EulaScreenHandler : public EulaView, public BaseScreenHandler, public TpmPasswordFetcherDelegate { public: - explicit EulaScreenHandler(CoreOobeActor* core_oobe_actor); + explicit EulaScreenHandler(CoreOobeView* core_oobe_view); ~EulaScreenHandler() override; // EulaView implementation: @@ -53,7 +53,7 @@ void HandleOnInstallationSettingsPopupOpened(); EulaScreen* screen_ = nullptr; - CoreOobeActor* core_oobe_actor_ = nullptr; + CoreOobeView* core_oobe_view_ = nullptr; // Help application used for help dialogs. scoped_refptr<HelpAppLauncher> help_app_;
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc index 4fadb2b..ab588c0c5 100644 --- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -226,10 +226,10 @@ GaiaScreenHandler::GaiaContext::GaiaContext() {} GaiaScreenHandler::GaiaScreenHandler( - CoreOobeActor* core_oobe_actor, + CoreOobeView* core_oobe_view, const scoped_refptr<NetworkStateInformer>& network_state_informer) : network_state_informer_(network_state_informer), - core_oobe_actor_(core_oobe_actor), + core_oobe_view_(core_oobe_view), weak_factory_(this) { DCHECK(network_state_informer_.get()); set_call_js_prefix(kJsScreenPath); @@ -526,7 +526,7 @@ break; } case authpolicy::ERROR_PASSWORD_EXPIRED: - core_oobe_actor_->ShowActiveDirectoryPasswordChangeScreen(username); + core_oobe_view_->ShowActiveDirectoryPasswordChangeScreen(username); break; case authpolicy::ERROR_PARSE_UPN_FAILED: case authpolicy::ERROR_BAD_USER_NAME: @@ -874,7 +874,7 @@ LoadAuthExtension(!gaia_silent_load_ /* force */, false /* offline */); signin_screen_handler_->UpdateUIState( SigninScreenHandler::UI_STATE_GAIA_SIGNIN, nullptr); - core_oobe_actor_->UpdateKeyboardState(); + core_oobe_view_->UpdateKeyboardState(); if (gaia_silent_load_) { // The variable is assigned to false because silently loaded Gaia page was @@ -883,12 +883,12 @@ } UpdateState(NetworkError::ERROR_REASON_UPDATE); - if (core_oobe_actor_) { + if (core_oobe_view_) { PrefService* prefs = g_browser_process->local_state(); if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { - core_oobe_actor_->ShowDeviceResetScreen(); + core_oobe_view_->ShowDeviceResetScreen(); } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { - core_oobe_actor_->ShowEnableDebuggingScreen(); + core_oobe_view_->ShowEnableDebuggingScreen(); } } }
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h index 5e3afa2d..4203fb04 100644 --- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
@@ -10,7 +10,7 @@ #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" +#include "chrome/browser/chromeos/login/screens/core_oobe_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" #include "chromeos/network/portal_detector/network_portal_detector.h" @@ -41,7 +41,7 @@ }; GaiaScreenHandler( - CoreOobeActor* core_oobe_actor, + CoreOobeView* core_oobe_view, const scoped_refptr<NetworkStateInformer>& network_state_informer); ~GaiaScreenHandler() override; @@ -220,7 +220,7 @@ // Network state informer used to keep signin screen up. scoped_refptr<NetworkStateInformer> network_state_informer_; - CoreOobeActor* core_oobe_actor_ = nullptr; + CoreOobeView* core_oobe_view_ = nullptr; // Email to pre-populate with. std::string populated_email_;
diff --git a/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc index b6d5803..1aaa7ec 100644 --- a/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc
@@ -11,7 +11,7 @@ #include "base/strings/string16.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/login/oobe_screen.h" -#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" +#include "chrome/browser/chromeos/login/screens/core_oobe_view.h" #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "chrome/common/pref_names.h" @@ -29,8 +29,8 @@ namespace chromeos { HIDDetectionScreenHandler::HIDDetectionScreenHandler( - CoreOobeActor* core_oobe_actor) - : core_oobe_actor_(core_oobe_actor) { + CoreOobeView* core_oobe_view) + : core_oobe_view_(core_oobe_view) { set_call_js_prefix(kJsScreenPath); } @@ -44,7 +44,7 @@ show_on_init_ = true; return; } - core_oobe_actor_->InitDemoModeDetection(); + core_oobe_view_->InitDemoModeDetection(); PrefService* local_state = g_browser_process->local_state(); int num_of_times_dialog_was_shown = local_state->GetInteger( @@ -109,7 +109,7 @@ void HIDDetectionScreenHandler::HandleOnContinue() { // Continue button pressed. - core_oobe_actor_->StopDemoModeDetection(); + core_oobe_view_->StopDemoModeDetection(); if (screen_) screen_->OnContinueButtonClicked(); }
diff --git a/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h index 4fb4b3837..154fc4b 100644 --- a/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h
@@ -17,15 +17,14 @@ namespace chromeos { -class CoreOobeActor; +class CoreOobeView; // WebUI implementation of HIDDetectionScreenView. class HIDDetectionScreenHandler : public HIDDetectionView, public BaseScreenHandler { public: - - explicit HIDDetectionScreenHandler(CoreOobeActor* core_oobe_actor); + explicit HIDDetectionScreenHandler(CoreOobeView* core_oobe_view); ~HIDDetectionScreenHandler() override; // HIDDetectionView implementation: @@ -51,7 +50,7 @@ HIDDetectionScreen* screen_ = nullptr; - CoreOobeActor* core_oobe_actor_ = nullptr; + CoreOobeView* core_oobe_view_ = nullptr; // If true, Initialize() will call Show(). bool show_on_init_ = false;
diff --git a/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc index 420d76a..0dc1b55 100644 --- a/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc
@@ -32,7 +32,7 @@ HostPairingScreenHandler::~HostPairingScreenHandler() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } void HostPairingScreenHandler::HandleContextReady() {
diff --git a/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h index 26df3e4..7bb74f4 100644 --- a/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h
@@ -6,13 +6,13 @@ #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_HOST_PAIRING_SCREEN_HANDLER_H_ #include "base/macros.h" -#include "chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/host_pairing_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "components/login/screens/screen_context.h" namespace chromeos { -class HostPairingScreenHandler : public HostPairingScreenActor, +class HostPairingScreenHandler : public HostPairingScreenView, public BaseScreenHandler { public: HostPairingScreenHandler(); @@ -35,7 +35,7 @@ void SetDelegate(Delegate* delegate) override; void OnContextChanged(const base::DictionaryValue& diff) override; - HostPairingScreenActor::Delegate* delegate_ = nullptr; + HostPairingScreenView::Delegate* delegate_ = nullptr; bool show_on_init_ = false; bool js_context_ready_ = false;
diff --git a/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc index d71d260..50d8b97c 100644 --- a/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc
@@ -39,7 +39,7 @@ KioskAutolaunchScreenHandler::~KioskAutolaunchScreenHandler() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); KioskAppManager::Get()->RemoveObserver(this); }
diff --git a/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.h index 3f1d51fd..2b5a9f7 100644 --- a/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.h
@@ -8,14 +8,14 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" -#include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "content/public/browser/web_ui.h" namespace chromeos { // WebUI implementation of KioskAutolaunchScreenActor. -class KioskAutolaunchScreenHandler : public KioskAutolaunchScreenActor, +class KioskAutolaunchScreenHandler : public KioskAutolaunchScreenView, public KioskAppManagerObserver, public BaseScreenHandler { public:
diff --git a/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc index 2046082..f2c86d7 100644 --- a/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
@@ -30,7 +30,7 @@ KioskEnableScreenHandler::~KioskEnableScreenHandler() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } void KioskEnableScreenHandler::Show() {
diff --git a/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h index 9d1b9bb..3abc661 100644 --- a/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h
@@ -9,13 +9,13 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" -#include "chrome/browser/chromeos/login/screens/kiosk_enable_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" namespace chromeos { // WebUI implementation of KioskEnableScreenActor. -class KioskEnableScreenHandler : public KioskEnableScreenActor, +class KioskEnableScreenHandler : public KioskEnableScreenView, public BaseScreenHandler { public: KioskEnableScreenHandler();
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc index a4811d1c..9b6bd696 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
@@ -118,13 +118,9 @@ // NetworkDropdown ------------------------------------------------------------- -NetworkDropdown::NetworkDropdown(Actor* actor, - content::WebUI* web_ui, - bool oobe) - : actor_(actor), - web_ui_(web_ui), - oobe_(oobe) { - DCHECK(actor_); +NetworkDropdown::NetworkDropdown(View* view, content::WebUI* web_ui, bool oobe) + : view_(view), web_ui_(web_ui), oobe_(oobe) { + DCHECK(view_); network_menu_.reset(new NetworkMenuWebUI(this, web_ui)); DCHECK(NetworkHandler::IsInitialized()); NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); @@ -162,7 +158,7 @@ } void NetworkDropdown::OnConnectToNetworkRequested() { - actor_->OnConnectToNetworkRequested(); + view_->OnConnectToNetworkRequested(); } void NetworkDropdown::DefaultNetworkChanged(const NetworkState* network) {
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.h b/chrome/browser/ui/webui/chromeos/login/network_dropdown.h index 1de3756d8..1ab6009 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.h +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.h
@@ -28,13 +28,13 @@ public NetworkStateHandlerObserver, public ash::network_icon::AnimationObserver { public: - class Actor { + class View { public: - virtual ~Actor() {} + virtual ~View() {} virtual void OnConnectToNetworkRequested() = 0; }; - NetworkDropdown(Actor* actor, content::WebUI* web_ui, bool oobe); + NetworkDropdown(View* view, content::WebUI* web_ui, bool oobe); ~NetworkDropdown() override; // This method should be called, when item with the given id is chosen. @@ -69,7 +69,7 @@ // The Network menu. std::unique_ptr<NetworkMenuWebUI> network_menu_; - Actor* actor_; + View* view_; content::WebUI* web_ui_;
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h index 6c70b655..4c0c64a 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h
@@ -16,7 +16,7 @@ namespace chromeos { class NetworkDropdownHandler : public BaseScreenHandler, - public NetworkDropdown::Actor { + public NetworkDropdown::View { public: class Observer { public:
diff --git a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc index 79f1ad63..14819d7 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
@@ -20,7 +20,7 @@ #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/customization/customization_document.h" #include "chrome/browser/chromeos/idle_detector.h" -#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" +#include "chrome/browser/chromeos/login/screens/core_oobe_view.h" #include "chrome/browser/chromeos/login/screens/network_screen.h" #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" @@ -54,10 +54,10 @@ // NetworkScreenHandler, public: ----------------------------------------------- -NetworkScreenHandler::NetworkScreenHandler(CoreOobeActor* core_oobe_actor) - : core_oobe_actor_(core_oobe_actor) { +NetworkScreenHandler::NetworkScreenHandler(CoreOobeView* core_oobe_view) + : core_oobe_view_(core_oobe_view) { set_call_js_prefix(kJsScreenPath); - DCHECK(core_oobe_actor_); + DCHECK(core_oobe_view_); } NetworkScreenHandler::~NetworkScreenHandler() { @@ -65,7 +65,7 @@ screen_->OnViewDestroyed(this); } -// NetworkScreenHandler, NetworkScreenActor implementation: -------------------- +// NetworkScreenHandler, NetworkScreenView implementation: --------------------- void NetworkScreenHandler::Show() { if (!page_is_ready()) { @@ -75,13 +75,13 @@ PrefService* prefs = g_browser_process->local_state(); if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { - if (core_oobe_actor_) - core_oobe_actor_->ShowDeviceResetScreen(); + if (core_oobe_view_) + core_oobe_view_->ShowDeviceResetScreen(); return; } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { - if (core_oobe_actor_) - core_oobe_actor_->ShowEnableDebuggingScreen(); + if (core_oobe_view_) + core_oobe_view_->ShowEnableDebuggingScreen(); return; } @@ -98,7 +98,7 @@ base::CommandLine::ForCurrentProcess()->HasSwitch( chromeos::switches::kSystemDevMode)); ShowScreenWithData(OobeScreen::SCREEN_OOBE_NETWORK, &network_screen_params); - core_oobe_actor_->InitDemoModeDetection(); + core_oobe_view_->InitDemoModeDetection(); } void NetworkScreenHandler::Hide() { @@ -120,11 +120,11 @@ void NetworkScreenHandler::ClearErrors() { if (page_is_ready()) - core_oobe_actor_->ClearErrors(); + core_oobe_view_->ClearErrors(); } void NetworkScreenHandler::StopDemoModeDetection() { - core_oobe_actor_->StopDemoModeDetection(); + core_oobe_view_->StopDemoModeDetection(); } void NetworkScreenHandler::ShowConnectingStatus( @@ -135,7 +135,7 @@ void NetworkScreenHandler::ReloadLocalizedContent() { base::DictionaryValue localized_strings; GetOobeUI()->GetLocalizedStrings(&localized_strings); - core_oobe_actor_->ReloadContent(localized_strings); + core_oobe_view_->ReloadContent(localized_strings); } // NetworkScreenHandler, BaseScreenHandler implementation: --------------------
diff --git a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.h index 2c735ad..a181032 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.h
@@ -19,13 +19,13 @@ namespace chromeos { -class CoreOobeActor; +class CoreOobeView; -// WebUI implementation of NetworkScreenActor. It is used to interact with +// WebUI implementation of NetworkScreenView. It is used to interact with // the welcome screen (part of the page) of the OOBE. class NetworkScreenHandler : public NetworkView, public BaseScreenHandler { public: - explicit NetworkScreenHandler(CoreOobeActor* core_oobe_actor); + explicit NetworkScreenHandler(CoreOobeView* core_oobe_view); ~NetworkScreenHandler() override; private: @@ -50,7 +50,7 @@ // Returns available timezones. Caller gets the ownership. static base::ListValue* GetTimezoneList(); - CoreOobeActor* core_oobe_actor_ = nullptr; + CoreOobeView* core_oobe_view_ = nullptr; NetworkScreen* screen_ = nullptr; // Keeps whether screen should be shown right after initialization.
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index c90b6a3..6d8ee2d 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -17,8 +17,8 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" -#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_actor.h" -#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" +#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h" +#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h" #include "chrome/browser/chromeos/login/screens/error_screen.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/wizard_controller.h" @@ -235,7 +235,7 @@ auto debugging_screen_handler = base::MakeUnique<EnableDebuggingScreenHandler>(); - debugging_screen_actor_ = debugging_screen_handler.get(); + debugging_screen_view_ = debugging_screen_handler.get(); AddScreenHandler(std::move(debugging_screen_handler)); auto eula_screen_handler = base::MakeUnique<EulaScreenHandler>(core_handler_); @@ -248,27 +248,27 @@ auto autolaunch_screen_handler = base::MakeUnique<KioskAutolaunchScreenHandler>(); - autolaunch_screen_actor_ = autolaunch_screen_handler.get(); + autolaunch_screen_view_ = autolaunch_screen_handler.get(); AddScreenHandler(std::move(autolaunch_screen_handler)); auto kiosk_enable_screen_handler = base::MakeUnique<KioskEnableScreenHandler>(); - kiosk_enable_screen_actor_ = kiosk_enable_screen_handler.get(); + kiosk_enable_screen_view_ = kiosk_enable_screen_handler.get(); AddScreenHandler(std::move(kiosk_enable_screen_handler)); auto supervised_user_creation_screen_handler = base::MakeUnique<SupervisedUserCreationScreenHandler>(); - supervised_user_creation_screen_actor_ = + supervised_user_creation_screen_view_ = supervised_user_creation_screen_handler.get(); AddScreenHandler(std::move(supervised_user_creation_screen_handler)); auto wrong_hwid_screen_handler = base::MakeUnique<WrongHWIDScreenHandler>(); - wrong_hwid_screen_actor_ = wrong_hwid_screen_handler.get(); + wrong_hwid_screen_view_ = wrong_hwid_screen_handler.get(); AddScreenHandler(std::move(wrong_hwid_screen_handler)); auto auto_enrollment_check_screen_handler = base::MakeUnique<AutoEnrollmentCheckScreenHandler>(); - auto_enrollment_check_screen_actor_ = + auto_enrollment_check_screen_view_ = auto_enrollment_check_screen_handler.get(); AddScreenHandler(std::move(auto_enrollment_check_screen_handler)); @@ -287,18 +287,17 @@ auto enrollment_screen_handler = base::MakeUnique<EnrollmentScreenHandler>( network_state_informer_, error_screen); - enrollment_screen_actor_ = enrollment_screen_handler.get(); + enrollment_screen_view_ = enrollment_screen_handler.get(); AddScreenHandler(std::move(enrollment_screen_handler)); auto terms_of_service_screen_handler = base::MakeUnique<TermsOfServiceScreenHandler>(core_handler_); - terms_of_service_screen_actor_ = terms_of_service_screen_handler.get(); + terms_of_service_screen_view_ = terms_of_service_screen_handler.get(); AddScreenHandler(std::move(terms_of_service_screen_handler)); auto arc_terms_of_service_screen_handler = base::MakeUnique<ArcTermsOfServiceScreenHandler>(); - arc_terms_of_service_screen_actor_ = - arc_terms_of_service_screen_handler.get(); + arc_terms_of_service_screen_view_ = arc_terms_of_service_screen_handler.get(); AddScreenHandler(std::move(arc_terms_of_service_screen_handler)); auto user_image_screen_handler = base::MakeUnique<UserImageScreenHandler>(); @@ -323,28 +322,28 @@ auto app_launch_splash_screen_handler = base::MakeUnique<AppLaunchSplashScreenHandler>(network_state_informer_, error_screen); - app_launch_splash_screen_actor_ = app_launch_splash_screen_handler.get(); + app_launch_splash_screen_view_ = app_launch_splash_screen_handler.get(); AddScreenHandler(std::move(app_launch_splash_screen_handler)); auto arc_kiosk_splash_screen_handler = base::MakeUnique<ArcKioskSplashScreenHandler>(); - arc_kiosk_splash_screen_actor_ = arc_kiosk_splash_screen_handler.get(); + arc_kiosk_splash_screen_view_ = arc_kiosk_splash_screen_handler.get(); AddScreenHandler(std::move(arc_kiosk_splash_screen_handler)); if (display_type_ == kOobeDisplay) { auto controller_pairing_handler = base::MakeUnique<ControllerPairingScreenHandler>(); - controller_pairing_screen_actor_ = controller_pairing_handler.get(); + controller_pairing_screen_view_ = controller_pairing_handler.get(); AddScreenHandler(std::move(controller_pairing_handler)); auto host_pairing_handler = base::MakeUnique<HostPairingScreenHandler>(); - host_pairing_screen_actor_ = host_pairing_handler.get(); + host_pairing_screen_view_ = host_pairing_handler.get(); AddScreenHandler(std::move(host_pairing_handler)); } auto device_disabled_screen_handler = base::MakeUnique<DeviceDisabledScreenHandler>(); - device_disabled_screen_actor_ = device_disabled_screen_handler.get(); + device_disabled_screen_view_ = device_disabled_screen_handler.get(); AddScreenHandler(std::move(device_disabled_screen_handler)); // Initialize KioskAppMenuHandler. Note that it is NOT a screen handler. @@ -392,7 +391,7 @@ } } -CoreOobeActor* OobeUI::GetCoreOobeActor() { +CoreOobeView* OobeUI::GetCoreOobeView() { return core_handler_; } @@ -408,56 +407,56 @@ return update_view_; } -EnableDebuggingScreenActor* OobeUI::GetEnableDebuggingScreenActor() { - return debugging_screen_actor_; +EnableDebuggingScreenView* OobeUI::GetEnableDebuggingScreenView() { + return debugging_screen_view_; } -EnrollmentScreenActor* OobeUI::GetEnrollmentScreenActor() { - return enrollment_screen_actor_; +EnrollmentScreenView* OobeUI::GetEnrollmentScreenView() { + return enrollment_screen_view_; } ResetView* OobeUI::GetResetView() { return reset_view_; } -KioskAutolaunchScreenActor* OobeUI::GetKioskAutolaunchScreenActor() { - return autolaunch_screen_actor_; +KioskAutolaunchScreenView* OobeUI::GetKioskAutolaunchScreenView() { + return autolaunch_screen_view_; } -KioskEnableScreenActor* OobeUI::GetKioskEnableScreenActor() { - return kiosk_enable_screen_actor_; +KioskEnableScreenView* OobeUI::GetKioskEnableScreenView() { + return kiosk_enable_screen_view_; } -TermsOfServiceScreenActor* OobeUI::GetTermsOfServiceScreenActor() { - return terms_of_service_screen_actor_; +TermsOfServiceScreenView* OobeUI::GetTermsOfServiceScreenView() { + return terms_of_service_screen_view_; } -ArcTermsOfServiceScreenActor* OobeUI::GetArcTermsOfServiceScreenActor() { - return arc_terms_of_service_screen_actor_; +ArcTermsOfServiceScreenView* OobeUI::GetArcTermsOfServiceScreenView() { + return arc_terms_of_service_screen_view_; } -WrongHWIDScreenActor* OobeUI::GetWrongHWIDScreenActor() { - return wrong_hwid_screen_actor_; +WrongHWIDScreenView* OobeUI::GetWrongHWIDScreenView() { + return wrong_hwid_screen_view_; } -AutoEnrollmentCheckScreenActor* OobeUI::GetAutoEnrollmentCheckScreenActor() { - return auto_enrollment_check_screen_actor_; +AutoEnrollmentCheckScreenView* OobeUI::GetAutoEnrollmentCheckScreenView() { + return auto_enrollment_check_screen_view_; } HIDDetectionView* OobeUI::GetHIDDetectionView() { return hid_detection_view_; } -ControllerPairingScreenActor* OobeUI::GetControllerPairingScreenActor() { - return controller_pairing_screen_actor_; +ControllerPairingScreenView* OobeUI::GetControllerPairingScreenView() { + return controller_pairing_screen_view_; } -HostPairingScreenActor* OobeUI::GetHostPairingScreenActor() { - return host_pairing_screen_actor_; +HostPairingScreenView* OobeUI::GetHostPairingScreenView() { + return host_pairing_screen_view_; } -DeviceDisabledScreenActor* OobeUI::GetDeviceDisabledScreenActor() { - return device_disabled_screen_actor_; +DeviceDisabledScreenView* OobeUI::GetDeviceDisabledScreenView() { + return device_disabled_screen_view_; } UserImageView* OobeUI::GetUserImageView() { @@ -469,15 +468,15 @@ } SupervisedUserCreationScreenHandler* - OobeUI::GetSupervisedUserCreationScreenActor() { - return supervised_user_creation_screen_actor_; +OobeUI::GetSupervisedUserCreationScreenView() { + return supervised_user_creation_screen_view_; } -GaiaScreenHandler* OobeUI::GetGaiaScreenActor() { +GaiaScreenHandler* OobeUI::GetGaiaScreenView() { return gaia_screen_handler_; } -UserBoardView* OobeUI::GetUserBoardScreenActor() { +UserBoardView* OobeUI::GetUserBoardView() { return user_board_screen_handler_; } @@ -485,13 +484,12 @@ core_handler_->UpdateShutdownAndRebootVisibility(reboot_on_shutdown); } -AppLaunchSplashScreenActor* - OobeUI::GetAppLaunchSplashScreenActor() { - return app_launch_splash_screen_actor_; +AppLaunchSplashScreenView* OobeUI::GetAppLaunchSplashScreenView() { + return app_launch_splash_screen_view_; } -ArcKioskSplashScreenActor* OobeUI::GetArcKioskSplashScreenActor() { - return arc_kiosk_splash_screen_actor_; +ArcKioskSplashScreenView* OobeUI::GetArcKioskSplashScreenView() { + return arc_kiosk_splash_screen_view_; } void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) { @@ -642,7 +640,7 @@ base::DictionaryValue localized_strings; GetLocalizedStrings(&localized_strings); - static_cast<CoreOobeActor*>(core_handler_)->ReloadContent(localized_strings); + static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings); } } // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h index 80e08072..03337457 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
@@ -28,25 +28,25 @@ } // namespace base namespace chromeos { -class AppLaunchSplashScreenActor; -class ArcKioskSplashScreenActor; -class ArcTermsOfServiceScreenActor; -class AutoEnrollmentCheckScreenActor; +class AppLaunchSplashScreenView; +class ArcKioskSplashScreenView; +class ArcTermsOfServiceScreenView; +class AutoEnrollmentCheckScreenView; class BaseScreenHandler; -class ControllerPairingScreenActor; -class CoreOobeActor; -class DeviceDisabledScreenActor; -class EnableDebuggingScreenActor; -class EnrollmentScreenActor; +class ControllerPairingScreenView; +class CoreOobeView; +class DeviceDisabledScreenView; +class EnableDebuggingScreenView; +class EnrollmentScreenView; class EulaView; class ErrorScreen; class ErrorScreenHandler; class GaiaScreenHandler; class HIDDetectionView; -class HostPairingScreenActor; +class HostPairingScreenView; class KioskAppMenuHandler; -class KioskAutolaunchScreenActor; -class KioskEnableScreenActor; +class KioskAutolaunchScreenView; +class KioskEnableScreenView; class LoginScreenContext; class NativeWindowDelegate; class NetworkDropdownHandler; @@ -56,12 +56,12 @@ class SigninScreenHandlerDelegate; class SupervisedUserCreationScreenHandler; class ResetView; -class TermsOfServiceScreenActor; +class TermsOfServiceScreenView; class UserBoardScreenHandler; class UserBoardView; class UserImageView; class UpdateView; -class WrongHWIDScreenActor; +class WrongHWIDScreenView; // A custom WebUI that defines datasource for out-of-box-experience (OOBE) UI: // - welcome screen (setup language/keyboard/network). @@ -94,31 +94,30 @@ OobeUI(content::WebUI* web_ui, const GURL& url); ~OobeUI() override; - CoreOobeActor* GetCoreOobeActor(); + CoreOobeView* GetCoreOobeView(); NetworkView* GetNetworkView(); EulaView* GetEulaView(); UpdateView* GetUpdateView(); - EnableDebuggingScreenActor* GetEnableDebuggingScreenActor(); - EnrollmentScreenActor* GetEnrollmentScreenActor(); + EnableDebuggingScreenView* GetEnableDebuggingScreenView(); + EnrollmentScreenView* GetEnrollmentScreenView(); ResetView* GetResetView(); - KioskAutolaunchScreenActor* GetKioskAutolaunchScreenActor(); - KioskEnableScreenActor* GetKioskEnableScreenActor(); - TermsOfServiceScreenActor* GetTermsOfServiceScreenActor(); - ArcTermsOfServiceScreenActor* GetArcTermsOfServiceScreenActor(); + KioskAutolaunchScreenView* GetKioskAutolaunchScreenView(); + KioskEnableScreenView* GetKioskEnableScreenView(); + TermsOfServiceScreenView* GetTermsOfServiceScreenView(); + ArcTermsOfServiceScreenView* GetArcTermsOfServiceScreenView(); UserImageView* GetUserImageView(); ErrorScreen* GetErrorScreen(); - WrongHWIDScreenActor* GetWrongHWIDScreenActor(); - AutoEnrollmentCheckScreenActor* GetAutoEnrollmentCheckScreenActor(); - SupervisedUserCreationScreenHandler* GetSupervisedUserCreationScreenActor(); - AppLaunchSplashScreenActor* GetAppLaunchSplashScreenActor(); - ArcKioskSplashScreenActor* GetArcKioskSplashScreenActor(); - bool IsJSReady(const base::Closure& display_is_ready_callback); + WrongHWIDScreenView* GetWrongHWIDScreenView(); + AutoEnrollmentCheckScreenView* GetAutoEnrollmentCheckScreenView(); + SupervisedUserCreationScreenHandler* GetSupervisedUserCreationScreenView(); + AppLaunchSplashScreenView* GetAppLaunchSplashScreenView(); + ArcKioskSplashScreenView* GetArcKioskSplashScreenView(); HIDDetectionView* GetHIDDetectionView(); - ControllerPairingScreenActor* GetControllerPairingScreenActor(); - HostPairingScreenActor* GetHostPairingScreenActor(); - DeviceDisabledScreenActor* GetDeviceDisabledScreenActor(); - GaiaScreenHandler* GetGaiaScreenActor(); - UserBoardView* GetUserBoardScreenActor(); + ControllerPairingScreenView* GetControllerPairingScreenView(); + HostPairingScreenView* GetHostPairingScreenView(); + DeviceDisabledScreenView* GetDeviceDisabledScreenView(); + GaiaScreenHandler* GetGaiaScreenView(); + UserBoardView* GetUserBoardView(); // ShutdownPolicyHandler::Delegate void OnShutdownPolicyChanged(bool reboot_on_shutdown) override; @@ -133,6 +132,8 @@ // async assets load id will be initialized. void OnScreenAssetsLoaded(const std::string& async_assets_load_id); + bool IsJSReady(const base::Closure& display_is_ready_callback); + // Shows or hides OOBE UI elements. void ShowOobeUI(bool show); @@ -154,7 +155,7 @@ const std::string& display_type() const { return display_type_; } - SigninScreenHandler* signin_screen_handler_for_test() { + SigninScreenHandler* signin_screen_handler() { return signin_screen_handler_; } @@ -186,25 +187,25 @@ // network dropdown. NetworkDropdownHandler* network_dropdown_handler_ = nullptr; - // Screens actors. Note, OobeUI owns them via |handlers_|, not directly here. + // Screens views. Note, OobeUI owns them via |handlers_|, not directly here. UpdateView* update_view_ = nullptr; NetworkView* network_view_ = nullptr; - EnableDebuggingScreenActor* debugging_screen_actor_ = nullptr; + EnableDebuggingScreenView* debugging_screen_view_ = nullptr; EulaView* eula_view_ = nullptr; - EnrollmentScreenActor* enrollment_screen_actor_ = nullptr; + EnrollmentScreenView* enrollment_screen_view_ = nullptr; ResetView* reset_view_ = nullptr; HIDDetectionView* hid_detection_view_ = nullptr; - KioskAutolaunchScreenActor* autolaunch_screen_actor_ = nullptr; - KioskEnableScreenActor* kiosk_enable_screen_actor_ = nullptr; - WrongHWIDScreenActor* wrong_hwid_screen_actor_ = nullptr; - AutoEnrollmentCheckScreenActor* auto_enrollment_check_screen_actor_ = nullptr; - SupervisedUserCreationScreenHandler* supervised_user_creation_screen_actor_ = + KioskAutolaunchScreenView* autolaunch_screen_view_ = nullptr; + KioskEnableScreenView* kiosk_enable_screen_view_ = nullptr; + WrongHWIDScreenView* wrong_hwid_screen_view_ = nullptr; + AutoEnrollmentCheckScreenView* auto_enrollment_check_screen_view_ = nullptr; + SupervisedUserCreationScreenHandler* supervised_user_creation_screen_view_ = nullptr; - AppLaunchSplashScreenActor* app_launch_splash_screen_actor_ = nullptr; - ArcKioskSplashScreenActor* arc_kiosk_splash_screen_actor_ = nullptr; - ControllerPairingScreenActor* controller_pairing_screen_actor_ = nullptr; - HostPairingScreenActor* host_pairing_screen_actor_ = nullptr; - DeviceDisabledScreenActor* device_disabled_screen_actor_ = nullptr; + AppLaunchSplashScreenView* app_launch_splash_screen_view_ = nullptr; + ArcKioskSplashScreenView* arc_kiosk_splash_screen_view_ = nullptr; + ControllerPairingScreenView* controller_pairing_screen_view_ = nullptr; + HostPairingScreenView* host_pairing_screen_view_ = nullptr; + DeviceDisabledScreenView* device_disabled_screen_view_ = nullptr; // Reference to ErrorScreenHandler that handles error screen // requests and forward calls from native code to JS side. @@ -222,8 +223,8 @@ // forwards calls from native code to JS side. SigninScreenHandler* signin_screen_handler_ = nullptr; - TermsOfServiceScreenActor* terms_of_service_screen_actor_ = nullptr; - ArcTermsOfServiceScreenActor* arc_terms_of_service_screen_actor_ = nullptr; + TermsOfServiceScreenView* terms_of_service_screen_view_ = nullptr; + ArcTermsOfServiceScreenView* arc_terms_of_service_screen_view_ = nullptr; UserImageView* user_image_view_ = nullptr; std::vector<BaseScreenHandler*> handlers_; // Non-owning pointers.
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index cf02376..4427b04 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -43,7 +43,7 @@ #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" #include "chrome/browser/chromeos/login/reauth_stats.h" -#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" +#include "chrome/browser/chromeos/login/screens/core_oobe_view.h" #include "chrome/browser/chromeos/login/screens/network_error.h" #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" @@ -291,11 +291,11 @@ SigninScreenHandler::SigninScreenHandler( const scoped_refptr<NetworkStateInformer>& network_state_informer, ErrorScreen* error_screen, - CoreOobeActor* core_oobe_actor, + CoreOobeView* core_oobe_view, GaiaScreenHandler* gaia_screen_handler) : network_state_informer_(network_state_informer), error_screen_(error_screen), - core_oobe_actor_(core_oobe_actor), + core_oobe_view_(core_oobe_view), caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() ->GetImeKeyboard() ->CapsLockIsEnabled()), @@ -306,7 +306,7 @@ weak_factory_(this) { DCHECK(network_state_informer_.get()); DCHECK(error_screen_); - DCHECK(core_oobe_actor_); + DCHECK(core_oobe_view_); gaia_screen_handler_->set_signin_screen_handler(this); network_state_informer_->AddObserver(this); @@ -676,6 +676,14 @@ zero_offline_timeout_for_test_ = true; } +bool SigninScreenHandler::GetKeyboardRemappedPrefValue( + const std::string& pref_name, + int* value) { + return focused_pod_account_id_ && focused_pod_account_id_->is_valid() && + user_manager::known_user::GetIntegerPref(*focused_pod_account_id_, + pref_name, value); +} + // SigninScreenHandler, private: ----------------------------------------------- void SigninScreenHandler::ShowImpl() { @@ -984,15 +992,15 @@ } void SigninScreenHandler::ClearAndEnablePassword() { - core_oobe_actor_->ResetSignInUI(false); + core_oobe_view_->ResetSignInUI(false); } void SigninScreenHandler::ClearUserPodPassword() { - core_oobe_actor_->ClearUserPodPassword(); + core_oobe_view_->ClearUserPodPassword(); } void SigninScreenHandler::RefocusCurrentPod() { - core_oobe_actor_->RefocusCurrentPod(); + core_oobe_view_->RefocusCurrentPod(); } void SigninScreenHandler::HidePinKeyboardIfNeeded(const AccountId& account_id) { @@ -1055,14 +1063,14 @@ const std::string& error_text, const std::string& help_link_text, HelpAppLauncher::HelpTopic help_topic_id) { - core_oobe_actor_->ShowSignInError(login_attempts, error_text, help_link_text, - help_topic_id); + core_oobe_view_->ShowSignInError(login_attempts, error_text, help_link_text, + help_topic_id); } void SigninScreenHandler::ShowErrorScreen(LoginDisplay::SigninError error_id) { switch (error_id) { case LoginDisplay::TPM_ERROR: - core_oobe_actor_->ShowTpmError(); + core_oobe_view_->ShowTpmError(); break; default: NOTREACHED() << "Unknown sign in error"; @@ -1071,12 +1079,12 @@ } void SigninScreenHandler::ShowSigninUI(const std::string& email) { - core_oobe_actor_->ShowSignInUI(email); + core_oobe_view_->ShowSignInUI(email); } void SigninScreenHandler::ShowPasswordChangedDialog(bool show_password_error, const std::string& email) { - core_oobe_actor_->ShowPasswordChangedScreen(show_password_error, email); + core_oobe_view_->ShowPasswordChangedScreen(show_password_error, email); } void SigninScreenHandler::ShowSigninScreenForCreds( @@ -1308,13 +1316,13 @@ PrefService* prefs = g_browser_process->local_state(); if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { - if (core_oobe_actor_) - core_oobe_actor_->ShowDeviceResetScreen(); + if (core_oobe_view_) + core_oobe_view_->ShowDeviceResetScreen(); return; } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { - if (core_oobe_actor_) - core_oobe_actor_->ShowEnableDebuggingScreen(); + if (core_oobe_view_) + core_oobe_view_->ShowEnableDebuggingScreen(); return; }
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h index b978a55..b174e1d 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
@@ -46,7 +46,7 @@ namespace chromeos { -class CoreOobeActor; +class CoreOobeView; class ErrorScreensHistogramHelper; class GaiaScreenHandler; class LoginFeedback; @@ -230,7 +230,7 @@ SigninScreenHandler( const scoped_refptr<NetworkStateInformer>& network_state_informer, ErrorScreen* error_screen, - CoreOobeActor* core_oobe_actor, + CoreOobeView* core_oobe_view, GaiaScreenHandler* gaia_screen_handler); ~SigninScreenHandler() override; @@ -270,6 +270,10 @@ // show instantaneously in tests. void ZeroOfflineTimeoutForTesting(); + // Gets the keyboard remapped pref value for |pref_name| key. Returns true if + // successful, otherwise returns false. + bool GetKeyboardRemappedPrefValue(const std::string& pref_name, int* value); + private: enum UIState { UI_STATE_UNKNOWN = 0, @@ -470,7 +474,7 @@ bool preferences_changed_delayed_ = false; ErrorScreen* error_screen_ = nullptr; - CoreOobeActor* core_oobe_actor_ = nullptr; + CoreOobeView* core_oobe_view_ = nullptr; NetworkStateInformer::State last_network_state_ = NetworkStateInformer::UNKNOWN;
diff --git a/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.cc index fb5dfbd4..8f6221dd 100644 --- a/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.cc
@@ -48,7 +48,7 @@ SupervisedUserCreationScreenHandler::~SupervisedUserCreationScreenHandler() { if (delegate_) { - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } }
diff --git a/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.h index 345541c..55e11d32 100644 --- a/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.h
@@ -26,10 +26,9 @@ public: virtual ~Delegate() {} - // This method is called, when actor is being destroyed. Note, if Delegate - // is destroyed earlier then it has to call SetDelegate(NULL). - virtual void OnActorDestroyed( - SupervisedUserCreationScreenHandler* actor) = 0; + // This method is called, when view is being destroyed. Note, if Delegate + // is destroyed earlier then it has to call SetDelegate(nullptr). + virtual void OnViewDestroyed(SupervisedUserCreationScreenHandler* view) = 0; // Starts supervised user creation flow, with manager identified by // |manager_id| and |manager_password|.
diff --git a/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc index ef316de01..351a685a 100644 --- a/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc
@@ -13,7 +13,7 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/base/locale_util.h" -#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" +#include "chrome/browser/chromeos/login/screens/core_oobe_view.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -37,14 +37,14 @@ namespace chromeos { TermsOfServiceScreenHandler::TermsOfServiceScreenHandler( - CoreOobeActor* core_oobe_actor) - : core_oobe_actor_(core_oobe_actor) { + CoreOobeView* core_oobe_view) + : core_oobe_view_(core_oobe_view) { set_call_js_prefix(kJsScreenPath); } TermsOfServiceScreenHandler::~TermsOfServiceScreenHandler() { if (screen_) - screen_->OnActorDestroyed(this); + screen_->OnViewDestroyed(this); } void TermsOfServiceScreenHandler::RegisterMessages() { @@ -138,7 +138,7 @@ // Update the screen contents to the new locale. base::DictionaryValue localized_strings; GetOobeUI()->GetLocalizedStrings(&localized_strings); - core_oobe_actor_->ReloadContent(localized_strings); + core_oobe_view_->ReloadContent(localized_strings); DoShow(); }
diff --git a/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.h index 88d1b47..e1ab445 100644 --- a/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.h
@@ -10,18 +10,18 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "chrome/browser/chromeos/base/locale_util.h" -#include "chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/terms_of_service_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" namespace chromeos { -class CoreOobeActor; +class CoreOobeView; -// The sole implementation of the TermsOfServiceScreenActor, using WebUI. +// The sole implementation of the TermsOfServiceScreenView, using WebUI. class TermsOfServiceScreenHandler : public BaseScreenHandler, - public TermsOfServiceScreenActor { + public TermsOfServiceScreenView { public: - explicit TermsOfServiceScreenHandler(CoreOobeActor* core_oobe_actor); + explicit TermsOfServiceScreenHandler(CoreOobeView* core_oobe_view); ~TermsOfServiceScreenHandler() override; // content::WebUIMessageHandler: @@ -31,7 +31,7 @@ void DeclareLocalizedValues( ::login::LocalizedValuesBuilder* builder) override; - // TermsOfServiceScreenActor: + // TermsOfServiceScreenView: void SetDelegate(Delegate* screen) override; void Show() override; void Hide() override; @@ -70,7 +70,7 @@ TermsOfServiceScreenHandler::Delegate* screen_ = nullptr; - CoreOobeActor* core_oobe_actor_ = nullptr; + CoreOobeView* core_oobe_view_ = nullptr; // Whether the screen should be shown right after initialization. bool show_on_init_ = false;
diff --git a/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc index 7767ab9c..e38c74c4 100644 --- a/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc
@@ -22,7 +22,7 @@ WrongHWIDScreenHandler::~WrongHWIDScreenHandler() { if (delegate_) - delegate_->OnActorDestroyed(this); + delegate_->OnViewDestroyed(this); } void WrongHWIDScreenHandler::Show() {
diff --git a/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h index 6dfdae54..54e5ee4b 100644 --- a/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h
@@ -7,14 +7,14 @@ #include "base/compiler_specific.h" #include "base/macros.h" -#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_actor.h" +#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "content/public/browser/web_ui.h" namespace chromeos { // WebUI implementation of WrongHWIDScreenActor. -class WrongHWIDScreenHandler : public WrongHWIDScreenActor, +class WrongHWIDScreenHandler : public WrongHWIDScreenView, public BaseScreenHandler { public: WrongHWIDScreenHandler();
diff --git a/chrome/browser/ui/webui/local_discovery/OWNERS b/chrome/browser/ui/webui/local_discovery/OWNERS index 58265a3..4633094 100644 --- a/chrome/browser/ui/webui/local_discovery/OWNERS +++ b/chrome/browser/ui/webui/local_discovery/OWNERS
@@ -1,2 +1,4 @@ gene@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/browser/ui/webui/signin/OWNERS b/chrome/browser/ui/webui/signin/OWNERS index 4344a30..af356eca 100644 --- a/chrome/browser/ui/webui/signin/OWNERS +++ b/chrome/browser/ui/webui/signin/OWNERS
@@ -3,3 +3,5 @@ msarda@chromium.org rogerta@chromium.org xiyuan@chromium.org + +# COMPONENT: Services>SignIn
diff --git a/chrome/browser/win/OWNERS b/chrome/browser/win/OWNERS index b9252b85..2621204 100644 --- a/chrome/browser/win/OWNERS +++ b/chrome/browser/win/OWNERS
@@ -7,4 +7,6 @@ per-file chrome_elf_init*=csharp@chromium.org per-file chrome_elf_init*=robertshield@chromium.org -per-file enumerate_modules_model*=finnur@chromium.org \ No newline at end of file +per-file enumerate_modules_model*=finnur@chromium.org + +# COMPONENT: Internals>Core
diff --git a/chrome/common/cloud_print/OWNERS b/chrome/common/cloud_print/OWNERS index adb99ff8..3a21c291 100644 --- a/chrome/common/cloud_print/OWNERS +++ b/chrome/common/cloud_print/OWNERS
@@ -1,3 +1,5 @@ gene@chromium.org scottbyer@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/common/conflicts/OWNERS b/chrome/common/conflicts/OWNERS index 22edb2c..ba30206 100644 --- a/chrome/common/conflicts/OWNERS +++ b/chrome/common/conflicts/OWNERS
@@ -3,3 +3,5 @@ chrisha@chromium.org pmonette@chromium.org + +# COMPONENT: Internals>Core
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include index 96fa9f9..a8666514 100644 --- a/chrome/installer/linux/common/installer.include +++ b/chrome/installer/linux/common/installer.include
@@ -166,11 +166,13 @@ echo Widevine signing "${STAGEDIR}/${INSTALLDIR}/${PROGNAME}" ${BUILDDIR}/installer/widevine/signature_generator.py \ --input_file "${STAGEDIR}/${INSTALLDIR}/${PROGNAME}" \ - --output_file "${STAGEDIR}/${INSTALLDIR}/${PROGNAME}.sig" + --output_file "${STAGEDIR}/${INSTALLDIR}/${PROGNAME}.sig" \ + --flags 1 echo Widevine signing "${STAGEDIR}/${INSTALLDIR}/libwidevinecdmadapter.so" ${BUILDDIR}/installer/widevine/signature_generator.py \ --input_file "${STAGEDIR}/${INSTALLDIR}/libwidevinecdmadapter.so" \ - --output_file "${STAGEDIR}/${INSTALLDIR}/libwidevinecdmadapter.so.sig" + --output_file "${STAGEDIR}/${INSTALLDIR}/libwidevinecdmadapter.so.sig" \ + --flags 0 # Widevine signature file already exists for libwidevinecdm.so. cp "${BUILDDIR}/libwidevinecdm.so.sig" "${STAGEDIR}/${INSTALLDIR}/" fi
diff --git a/chrome/service/OWNERS b/chrome/service/OWNERS index adb99ff8..3a21c291 100644 --- a/chrome/service/OWNERS +++ b/chrome/service/OWNERS
@@ -1,3 +1,5 @@ gene@chromium.org scottbyer@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 471f316..3716faa 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -577,8 +577,8 @@ ] } if (is_win || is_linux) { - # TODO(crbug.com/679127): Enable these tests on "mac_views_browser" once - # it is supported. + # TODO(crbug.com/679127): Investigate why these tests currently break + # on Mac, and enable them. sources += [ "../browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc", "../browser/ui/views/payments/payment_request_interactive_uitest.cc", @@ -1194,6 +1194,7 @@ deps += [ "//mash/package", + "//mash/session/public/interfaces:constants", "//services/service_manager/background:lib", ] @@ -2014,13 +2015,6 @@ ] } - # TODO(crbug.com/679127): Enable these tests on "mac_views_browser" once it - # is supported. - if (is_linux || is_win) { - sources += - [ "../browser/payments/site_per_process_payments_browsertest.cc" ] - } - if (enable_captive_portal_detection) { sources += [ "../browser/ssl/captive_portal_blocking_page_browsertest.cc" ] @@ -2143,6 +2137,7 @@ } if (toolkit_views) { sources += [ + "../browser/payments/site_per_process_payments_browsertest.cc", "../browser/ui/global_error/global_error_service_browsertest.cc", "../browser/ui/views/external_protocol_dialog_browsertest.cc", "../browser/ui/views/frame/browser_non_client_frame_view_browsertest_win.cc", @@ -3366,6 +3361,7 @@ "../browser/ui/bookmarks/bookmark_ui_utils_desktop_unittest.cc", "../browser/ui/bookmarks/recently_used_folders_combo_model_unittest.cc", "../browser/ui/chrome_select_file_policy_unittest.cc", + "../browser/ui/cocoa/location_bar/location_bar_view_mac_unittest.mm", "../browser/ui/find_bar/find_backend_unittest.cc", "../browser/ui/login/login_handler_unittest.cc", "../browser/ui/passwords/manage_passwords_state_unittest.cc", @@ -4812,6 +4808,9 @@ "../browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc", "../browser/ui/views/confirm_bubble_views_unittest.cc", "../browser/ui/views/global_error_bubble_view_unittest.cc", + "../browser/ui/views/payments/credit_card_editor_view_controller_unittest.cc", + "../browser/ui/views/payments/validating_textfield_unittest.cc", + "../browser/ui/views/payments/view_stack_unittest.cc", "../browser/ui/views/website_settings/website_settings_popup_view_unittest.cc", ] if (is_chromeos) { @@ -4844,9 +4843,6 @@ "../browser/ui/views/frame/web_contents_close_handler_unittest.cc", "../browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc", "../browser/ui/views/omnibox/omnibox_view_views_unittest.cc", - "../browser/ui/views/payments/credit_card_editor_view_controller_unittest.cc", - "../browser/ui/views/payments/validating_textfield_unittest.cc", - "../browser/ui/views/payments/view_stack_unittest.cc", "../browser/ui/views/status_icons/status_tray_win_unittest.cc", "../browser/ui/views/sync/bubble_sync_promo_view_unittest.cc", "../browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views_unittest.cc",
diff --git a/chrome/test/DEPS b/chrome/test/DEPS index c65a276..cfc1016 100644 --- a/chrome/test/DEPS +++ b/chrome/test/DEPS
@@ -10,6 +10,7 @@ "+device/geolocation", "+extensions", "+mash/package", + "+mash/session/public/interfaces", "+mojo", "+rlz/features", "+services",
diff --git a/chrome/test/base/mash_browser_tests_main.cc b/chrome/test/base/mash_browser_tests_main.cc index a97abff..bc097e1 100644 --- a/chrome/test/base/mash_browser_tests_main.cc +++ b/chrome/test/base/mash_browser_tests_main.cc
@@ -27,6 +27,7 @@ #include "content/public/common/service_manager_connection.h" #include "content/public/test/test_launcher.h" #include "mash/package/mash_packaged_service.h" +#include "mash/session/public/interfaces/constants.mojom.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/service.h" #include "services/service_manager/public/cpp/service_context.h" @@ -43,7 +44,7 @@ FILE_PATH_LITERAL("mash_browser_tests_catalog.json"); void ConnectToDefaultApps(service_manager::Connector* connector) { - connector->Connect("mash_session"); + connector->Connect(mash::session::mojom::kServiceName); } class MashTestSuite : public ChromeTestSuite {
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index 1adb0e2d..c6c901c 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -83,8 +83,6 @@ # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1673 'ChromeDownloadDirTest.testFileDownloadWithGet', 'ChromeDriverPageLoadTimeoutTest.*', - # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1683 - 'ChromeDriverTest.testShadowDomClick', ] _VERSION_SPECIFIC_FILTER['57'] = [ # https://code.google.com/p/chromedriver/issues/detail?id=992 @@ -2257,6 +2255,8 @@ if util.IsLinux() and not util.Is64Bit(): # Workaround for crbug.com/611886. cmd.append('--no-sandbox') + # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1695 + cmd.append('--disable-gpu') process = subprocess.Popen(cmd) if process is None: raise RuntimeError('Chrome could not be started with debugging port')
diff --git a/chrome/test/chromedriver/test/test_expectations b/chrome/test/chromedriver/test/test_expectations index fb8da8e5..8d893ea 100644 --- a/chrome/test/chromedriver/test/test_expectations +++ b/chrome/test/chromedriver/test/test_expectations
@@ -147,24 +147,6 @@ ] _SPECIFIC_OS_REVISION_NEGATIVE_FILTER = {} -_SPECIFIC_OS_REVISION_NEGATIVE_FILTER['linux_HEAD'] = [ - # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1683 - 'ClickScrollingTest.testShouldBeAbleToClickElementInAFrameThatIsOutOfView', - 'ClickScrollingTest.testShouldBeAbleToClickElementThatIsOutOfViewInAFrameThatIsOutOfView', - 'ClickTest.testClickingLabelShouldSetCheckbox', - 'ElementFindingTest.testRemovingAnElementDynamicallyFromTheDomShouldCauseAStaleRefException', - 'FrameSwitchingTest.testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUs', -] -_SPECIFIC_OS_REVISION_NEGATIVE_FILTER['win_HEAD'] = [ - # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1683 - 'RenderedWebElementTest.testMoveRelativeToBody', - 'RenderedWebElementTest.testCanClickOnSuckerFishMenuItem', - 'BasicKeyboardInterfaceTest.testBasicKeyboardInput', -] -_SPECIFIC_OS_REVISION_NEGATIVE_FILTER['mac_HEAD'] = [ - # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1683 - 'AlertsTest.testShouldHandleAlertOnPageLoad', -] _OS_NEGATIVE_FILTER['android:chrome'] = [ 'ChromeOptionsFunctionalTest.canStartChromeWithCustomOptions',
diff --git a/chrome/test/conflicts/OWNERS b/chrome/test/conflicts/OWNERS index 2ffdf656..186b2df 100644 --- a/chrome/test/conflicts/OWNERS +++ b/chrome/test/conflicts/OWNERS
@@ -1,2 +1,4 @@ chrisha@chromium.org pmonette@chromium.org + +# COMPONENT: Internals>Core
diff --git a/chrome/test/data/extensions/platform_apps/window_api/test.js b/chrome/test/data/extensions/platform_apps/window_api/test.js index 8b73af8..b3a90279 100644 --- a/chrome/test/data/extensions/platform_apps/window_api/test.js +++ b/chrome/test/data/extensions/platform_apps/window_api/test.js
@@ -399,6 +399,25 @@ })); }, + // Regression for crbug.com/694248. + function testInnerBoundsNegativeZero() { + var innerBounds = { + left: -0, + top: 100, + width: 400, + height: 300, + }; + chrome.app.window.create('test.html', { + innerBounds: innerBounds + }, callbackPass(function(win) { + chrome.test.assertTrue(win != null); + assertBoundsEq(innerBounds, win.innerBounds); + assertBoundsConsistent(win); + assertConstraintsUnspecified(win); + win.close(); + })); + }, + function testOuterBoundsOnly() { var outerBounds = { left: 150,
diff --git a/chrome/test/data/webui/settings/about_page_tests.js b/chrome/test/data/webui/settings/about_page_tests.js index 9e02715..32837a6 100644 --- a/chrome/test/data/webui/settings/about_page_tests.js +++ b/chrome/test/data/webui/settings/about_page_tests.js
@@ -152,11 +152,16 @@ function registerAboutPageTests() { /** * @param {!UpdateStatus} status - * @param {number=} opt_progress + * @param {{ + * progress: number|undefined, + * message: string|undefined + * }} opt_options */ - function fireStatusChanged(status, opt_progress) { + function fireStatusChanged(status, opt_options) { + var options = opt_options || {}; cr.webUIListenerCallback('update-status-changed', { - progress: opt_progress === undefined ? 1 : opt_progress, + progress: options.progress === undefined ? 1 : options.progress, + message: options.message, status: status, }); } @@ -224,14 +229,14 @@ assertNotEquals(previousMessageText, statusMessageEl.textContent); previousMessageText = statusMessageEl.textContent; - fireStatusChanged(UpdateStatus.UPDATING, 0); + fireStatusChanged(UpdateStatus.UPDATING, {progress: 0}); assertEquals(SPINNER_ICON, icon.src); assertEquals(null, icon.getAttribute('icon')); assertFalse(statusMessageEl.textContent.includes('%')); assertNotEquals(previousMessageText, statusMessageEl.textContent); previousMessageText = statusMessageEl.textContent; - fireStatusChanged(UpdateStatus.UPDATING, 1); + fireStatusChanged(UpdateStatus.UPDATING, {progress: 1}); assertNotEquals(previousMessageText, statusMessageEl.textContent); assertTrue(statusMessageEl.textContent.includes('%')); previousMessageText = statusMessageEl.textContent; @@ -258,6 +263,14 @@ assertEquals(0, statusMessageEl.textContent.trim().length); }); + test('ErrorMessageWithHtml', function() { + var htmlError = 'hello<br>there<br>was<pre>an</pre>error'; + fireStatusChanged( + UpdateStatus.FAILED, {message: htmlError}); + var statusMessageEl = page.$.updateStatusMessage; + assertEquals(htmlError, statusMessageEl.innerHTML); + }); + /** * Test that when the current platform has been marked as deprecated (but * not end of the line) a deprecation warning message is displayed,
diff --git a/chrome/tools/service_discovery_sniffer/OWNERS b/chrome/tools/service_discovery_sniffer/OWNERS index 58265a3..4633094 100644 --- a/chrome/tools/service_discovery_sniffer/OWNERS +++ b/chrome/tools/service_discovery_sniffer/OWNERS
@@ -1,2 +1,4 @@ gene@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chrome/utility/cloud_print/OWNERS b/chrome/utility/cloud_print/OWNERS index 58265a3..4633094 100644 --- a/chrome/utility/cloud_print/OWNERS +++ b/chrome/utility/cloud_print/OWNERS
@@ -1,2 +1,4 @@ gene@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/chromecast/browser/cast_web_view.cc b/chromecast/browser/cast_web_view.cc index 4c90dca..e11f7cc 100644 --- a/chromecast/browser/cast_web_view.cc +++ b/chromecast/browser/cast_web_view.cc
@@ -4,6 +4,8 @@ #include "chromecast/browser/cast_web_view.h" +#include <utility> + #include "base/logging.h" #include "base/threading/thread_task_runner_handle.h" #include "chromecast/base/metrics/cast_metrics_helper.h" @@ -48,13 +50,6 @@ content::WebContents* web_contents = content::WebContents::Create(create_params); -#if defined(USE_AURA) - // Resize window - aura::Window* content_window = web_contents->GetNativeView(); - content_window->SetBounds( - gfx::Rect(display_size.width(), display_size.height())); -#endif - #if defined(OS_ANDROID) content::RendererPreferences* prefs = web_contents->GetMutableRendererPrefs(); prefs->use_video_overlay_for_embedded_encrypted_video = true; @@ -76,6 +71,7 @@ transparent_(transparent), window_(shell::CastContentWindow::Create(delegate)), web_contents_(CreateWebContents(browser_context_, site_instance_)), + did_start_navigation_(false), weak_factory_(this) { DCHECK(delegate_); DCHECK(browser_context_); @@ -234,6 +230,11 @@ void CastWebView::DidStartNavigation( content::NavigationHandle* navigation_handle) { + if (did_start_navigation_) { + return; + } + did_start_navigation_ = true; + #if defined(USE_AURA) // Resize window gfx::Size display_size =
diff --git a/chromecast/browser/cast_web_view.h b/chromecast/browser/cast_web_view.h index 26195913..f55f4ef1 100644 --- a/chromecast/browser/cast_web_view.h +++ b/chromecast/browser/cast_web_view.h
@@ -103,6 +103,7 @@ const bool transparent_; const std::unique_ptr<shell::CastContentWindow> window_; std::unique_ptr<content::WebContents> web_contents_; + bool did_start_navigation_; base::WeakPtrFactory<CastWebView> weak_factory_;
diff --git a/chromecast/browser/service/cast_service_simple.cc b/chromecast/browser/service/cast_service_simple.cc index 96c4a48..56144b72 100644 --- a/chromecast/browser/service/cast_service_simple.cc +++ b/chromecast/browser/service/cast_service_simple.cc
@@ -61,8 +61,8 @@ cast_web_view_ = base::MakeUnique<CastWebView>(this, browser_context(), /*site_instance*/ nullptr, /*transparent*/ false); - cast_web_view_->Show(window_manager_); cast_web_view_->LoadUrl(startup_url_); + cast_web_view_->Show(window_manager_); } void CastServiceSimple::StopInternal() {
diff --git a/components/cast_certificate/cast_cert_validator.cc b/components/cast_certificate/cast_cert_validator.cc index 2a48ca3..60c76fb 100644 --- a/components/cast_certificate/cast_cert_validator.cc +++ b/components/cast_certificate/cast_cert_validator.cc
@@ -13,8 +13,8 @@ #include "base/memory/ptr_util.h" #include "base/memory/singleton.h" -#include "net/cert/internal/cert_issuer_source_static.h" #include "components/cast_certificate/cast_crl.h" +#include "net/cert/internal/cert_issuer_source_static.h" #include "net/cert/internal/certificate_policies.h" #include "net/cert/internal/extended_key_usage.h" #include "net/cert/internal/parse_certificate.h" @@ -25,6 +25,7 @@ #include "net/cert/internal/signature_policy.h" #include "net/cert/internal/trust_store_in_memory.h" #include "net/cert/internal/verify_signed_data.h" +#include "net/cert/x509_util.h" #include "net/der/encode_values.h" #include "net/der/input.h" @@ -286,7 +287,8 @@ net::CertIssuerSourceStatic intermediate_cert_issuer_source; for (size_t i = 0; i < certs.size(); ++i) { scoped_refptr<net::ParsedCertificate> cert(net::ParsedCertificate::Create( - certs[i], GetCertParsingOptions(), &errors)); + net::x509_util::CreateCryptoBuffer(certs[i]), GetCertParsingOptions(), + &errors)); // TODO(eroman): Propagate/log these parsing errors. if (!cert) return false;
diff --git a/components/cast_certificate/cast_cert_validator_test_helpers.cc b/components/cast_certificate/cast_cert_validator_test_helpers.cc index b63be34..d9ade267 100644 --- a/components/cast_certificate/cast_cert_validator_test_helpers.cc +++ b/components/cast_certificate/cast_cert_validator_test_helpers.cc
@@ -4,10 +4,11 @@ #include "components/cast_certificate/cast_cert_validator_test_helpers.h" -#include "net/cert/internal/cert_errors.h" #include "base/files/file_util.h" #include "base/path_service.h" +#include "net/cert/internal/cert_errors.h" #include "net/cert/pem_tokenizer.h" +#include "net/cert/x509_util.h" #include "testing/gtest/include/gtest/gtest.h" namespace cast_certificate { @@ -89,8 +90,8 @@ cast_certificate::testing::ReadCertificateChainFromFile(path); for (const auto& trusted_root : trusted_test_roots) { net::CertErrors errors; - scoped_refptr<net::ParsedCertificate> cert( - net::ParsedCertificate::Create(trusted_root, {}, &errors)); + scoped_refptr<net::ParsedCertificate> cert(net::ParsedCertificate::Create( + net::x509_util::CreateCryptoBuffer(trusted_root), {}, &errors)); EXPECT_TRUE(cert) << errors.ToDebugString(); scoped_refptr<net::TrustAnchor> anchor = net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert));
diff --git a/components/cast_certificate/cast_cert_validator_unittest.cc b/components/cast_certificate/cast_cert_validator_unittest.cc index 1896755..a32e728 100644 --- a/components/cast_certificate/cast_cert_validator_unittest.cc +++ b/components/cast_certificate/cast_cert_validator_unittest.cc
@@ -8,6 +8,7 @@ #include "net/cert/internal/cert_errors.h" #include "net/cert/internal/parsed_certificate.h" #include "net/cert/internal/trust_store_in_memory.h" +#include "net/cert/x509_util.h" #include "testing/gtest/include/gtest/gtest.h" namespace cast_certificate { @@ -82,7 +83,8 @@ // Parse the root certificate of the chain. net::CertErrors errors; scoped_refptr<net::ParsedCertificate> root = - net::ParsedCertificate::Create(certs.back(), {}, &errors); + net::ParsedCertificate::Create( + net::x509_util::CreateCryptoBuffer(certs.back()), {}, &errors); ASSERT_TRUE(root) << errors.ToDebugString(); // Remove it from the chain.
diff --git a/components/cast_certificate/cast_crl.cc b/components/cast_certificate/cast_crl.cc index d805f7f..fa95ae3 100644 --- a/components/cast_certificate/cast_crl.cc +++ b/components/cast_certificate/cast_crl.cc
@@ -22,6 +22,7 @@ #include "net/cert/internal/verify_certificate_chain.h" #include "net/cert/internal/verify_signed_data.h" #include "net/cert/x509_certificate.h" +#include "net/cert/x509_util.h" #include "net/der/encode_values.h" #include "net/der/input.h" #include "net/der/parse_values.h" @@ -110,7 +111,9 @@ // Verify the trust of the CRL authority. net::CertErrors parse_errors; scoped_refptr<net::ParsedCertificate> parsed_cert = - net::ParsedCertificate::Create(crl.signer_cert(), {}, &parse_errors); + net::ParsedCertificate::Create( + net::x509_util::CreateCryptoBuffer(crl.signer_cert()), {}, + &parse_errors); if (parsed_cert == nullptr) { VLOG(2) << "CRL - Issuer certificate parsing failed:\n" << parse_errors.ToDebugString();
diff --git a/components/cloud_devices/OWNERS b/components/cloud_devices/OWNERS index 58265a3..6e670c1 100644 --- a/components/cloud_devices/OWNERS +++ b/components/cloud_devices/OWNERS
@@ -1,2 +1,5 @@ +thestig@chromium.org gene@chromium.org vitalybuka@chromium.org + +# COMPONENT: Services>CloudPrint
diff --git a/components/exo/display.cc b/components/exo/display.cc index 4216d8a..44b975a2 100644 --- a/components/exo/display.cc +++ b/components/exo/display.cc
@@ -179,6 +179,7 @@ std::unique_ptr<ShellSurface> Display::CreateRemoteShellSurface( Surface* surface, + const gfx::Point& origin, int container) { TRACE_EVENT2("exo", "Display::CreateRemoteShellSurface", "surface", surface->AsTracedValue(), "container", container); @@ -192,7 +193,7 @@ bool can_minimize = container != ash::kShellWindowId_SystemModalContainer; return base::MakeUnique<ShellSurface>( - surface, nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), + surface, nullptr, ShellSurface::BoundsMode::CLIENT, origin, true /* activatable */, can_minimize, container); }
diff --git a/components/exo/display.h b/components/exo/display.h index dd9098a..7e9ee4e 100644 --- a/components/exo/display.h +++ b/components/exo/display.h
@@ -74,8 +74,10 @@ const gfx::Point& position); // Creates a remote shell surface for an existing surface using |container|. - std::unique_ptr<ShellSurface> CreateRemoteShellSurface(Surface* surface, - int container); + std::unique_ptr<ShellSurface> CreateRemoteShellSurface( + Surface* surface, + const gfx::Point& origin, + int container); // Creates a sub-surface for an existing surface. The sub-surface will be // a child of |parent|.
diff --git a/components/exo/display_unittest.cc b/components/exo/display_unittest.cc index a27d0d6..a9a4f0e 100644 --- a/components/exo/display_unittest.cc +++ b/components/exo/display_unittest.cc
@@ -147,12 +147,13 @@ // Create a remote shell surface for surface1. std::unique_ptr<ShellSurface> shell_surface1 = display->CreateRemoteShellSurface( - surface1.get(), ash::kShellWindowId_SystemModalContainer); + surface1.get(), gfx::Point(), + ash::kShellWindowId_SystemModalContainer); EXPECT_TRUE(shell_surface1); // Create a remote shell surface for surface2. std::unique_ptr<ShellSurface> shell_surface2 = - display->CreateRemoteShellSurface(surface2.get(), + display->CreateRemoteShellSurface(surface2.get(), gfx::Point(), ash::kShellWindowId_DefaultContainer); EXPECT_TRUE(shell_surface2); }
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc index 7183474b..e5322a67 100644 --- a/components/exo/shell_surface.cc +++ b/components/exo/shell_surface.cc
@@ -369,8 +369,10 @@ break; } - if (widget_) + if (widget_) { UpdateWidgetBounds(); + UpdateShadow(); + } } void ShellSurface::SetParent(ShellSurface* parent) { @@ -629,7 +631,29 @@ void ShellSurface::SetOrigin(const gfx::Point& origin) { TRACE_EVENT1("exo", "ShellSurface::SetOrigin", "origin", origin.ToString()); + if (origin == origin_) + return; + + if (bounds_mode_ != BoundsMode::CLIENT) { + origin_ = origin; + return; + } + + // If the origin changed, give the client a chance to adjust window positions + // before switching to the new coordinate system. Retain the old origin by + // reverting the origin delta until the next configure is acknowledged. + gfx::Vector2d delta = origin - origin_; + origin_offset_ -= delta; + pending_origin_offset_accumulator_ += delta; + origin_ = origin; + + if (widget_) { + UpdateWidgetBounds(); + UpdateShadow(); + } + + Configure(); } void ShellSurface::SetActivatable(bool activatable) { @@ -676,10 +700,12 @@ if (enabled() && !widget_) { // Defer widget creation until surface contains some contents. - if (surface_->content_size().IsEmpty()) + if (surface_->content_size().IsEmpty()) { Configure(); - else - CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); + return; + } + + CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); } // Apply the accumulated pending origin offset to reflect acknowledged @@ -871,7 +897,10 @@ // cross-fade animations. The configure callback provides a mechanism for // the client to inform us that a frame has taken the state change into // account and without this cross-fade animations are unreliable. - if (configure_callback_.is_null()) + + // TODO(domlaskowski): For shell surfaces whose bounds are controlled by the + // client, the configure callback does not yet support window state changes. + if (configure_callback_.is_null() || bounds_mode_ == BoundsMode::CLIENT) scoped_animations_disabled_.reset(new ScopedAnimationsDisabled(this)); } } @@ -903,6 +932,11 @@ void ShellSurface::OnWindowBoundsChanged(aura::Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) { + // TODO(domlaskowski): For shell surfaces whose bounds are controlled by the + // client, the configure callback does not yet support resizing. + if (bounds_mode_ == BoundsMode::CLIENT) + return; + if (!widget_ || !surface_ || ignore_window_bounds_changes_) return; @@ -1154,10 +1188,11 @@ serial = configure_callback_.Run( non_client_view->frame_view()->GetBoundsForClientView().size(), ash::wm::GetWindowState(widget_->GetNativeWindow())->GetStateType(), - IsResizing(), widget_->IsActive()); + IsResizing(), widget_->IsActive(), origin_); } else { - serial = configure_callback_.Run( - gfx::Size(), ash::wm::WINDOW_STATE_TYPE_NORMAL, false, false); + serial = configure_callback_.Run(gfx::Size(), + ash::wm::WINDOW_STATE_TYPE_NORMAL, false, + false, origin_); } } @@ -1290,21 +1325,16 @@ } gfx::Point ShellSurface::GetSurfaceOrigin() const { - // For client-positioned shell surfaces, the surface origin corresponds to the - // widget position relative to the origin specified by the client. Since the - // surface is positioned relative to the widget, negate this vector to align - // the surface with the widget. - if (bounds_mode_ != BoundsMode::SHELL) { - gfx::Point position = widget_->GetNativeWindow()->bounds().origin(); - wm::ConvertPointToScreen(widget_->GetNativeWindow()->parent(), &position); - return origin_ - position.OffsetFromOrigin(); - } + DCHECK(bounds_mode_ == BoundsMode::SHELL || resize_component_ == HTCAPTION); gfx::Rect visible_bounds = GetVisibleBounds(); gfx::Rect client_bounds = widget_->non_client_view()->frame_view()->GetBoundsForClientView(); switch (resize_component_) { case HTCAPTION: + if (bounds_mode_ == BoundsMode::CLIENT) + return origin_ + origin_offset_ - visible_bounds.OffsetFromOrigin(); + return gfx::Point() + origin_offset_ - visible_bounds.OffsetFromOrigin(); case HTBOTTOM: case HTRIGHT: @@ -1357,8 +1387,8 @@ switch (bounds_mode_) { case BoundsMode::CLIENT: case BoundsMode::FIXED: - // Position is relative to the origin. - new_widget_bounds += origin_.OffsetFromOrigin(); + new_widget_bounds.set_origin(origin_ - + GetSurfaceOrigin().OffsetFromOrigin()); break; case BoundsMode::SHELL: // Update widget origin using the surface origin if the current location @@ -1407,22 +1437,41 @@ wm::SetShadowElevation(window, wm::ShadowElevation::MEDIUM); gfx::Rect shadow_content_bounds = gfx::ScaleToEnclosedRect(shadow_content_bounds_, 1.f / scale_); + + // Convert from screen to display coordinates. + if (!shadow_content_bounds.IsEmpty()) { + gfx::Point origin = shadow_content_bounds.origin() - origin_offset_; + wm::ConvertPointFromScreen(window->parent(), &origin); + shadow_content_bounds.set_origin(origin); + } + gfx::Rect shadow_underlay_bounds = shadow_content_bounds_; - if (shadow_underlay_bounds.IsEmpty()) + + if (shadow_underlay_bounds.IsEmpty()) { shadow_underlay_bounds = gfx::Rect(surface_->window()->bounds().size()); + } else if (shadow_underlay_in_surface_) { + // Since the shadow underlay is positioned relative to the surface, its + // origin corresponds to the shadow content position relative to the + // origin specified by the client. + shadow_underlay_bounds -= + gfx::ScaleToCeiledPoint(origin_ + origin_offset_, scale_) + .OffsetFromOrigin(); + } if (!shadow_underlay_in_surface_) { shadow_content_bounds = shadow_content_bounds_; if (shadow_content_bounds.IsEmpty()) { shadow_content_bounds = window->bounds(); + } else { + // Convert from screen to display coordinates. + gfx::Point origin = shadow_content_bounds.origin() - origin_offset_; + wm::ConvertPointFromScreen(window->parent(), &origin); + shadow_content_bounds.set_origin(origin); } } - // TODO(oshima): Adjust the coordinates from client screen to - // chromeos screen when multi displays are supported. - gfx::Point origin = window->bounds().origin(); gfx::Point shadow_origin = shadow_content_bounds.origin(); - shadow_origin -= origin.OffsetFromOrigin(); + shadow_origin -= window->bounds().OffsetFromOrigin(); gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds.size()); // Always create and show the underlay, even in maximized/fullscreen.
diff --git a/components/exo/shell_surface.h b/components/exo/shell_surface.h index 20b6d5b..74ff30d 100644 --- a/components/exo/shell_surface.h +++ b/components/exo/shell_surface.h
@@ -56,7 +56,8 @@ // // When bounds are controlled by the client, it represents the origin of a // coordinate system to which the position of the shell surface, specified - // as part of the geometry, is relative. + // as part of the geometry, is relative. The client must acknowledge changes + // to the origin, and offset the geometry accordingly. ShellSurface(Surface* surface, ShellSurface* parent, BoundsMode bounds_mode, @@ -96,7 +97,8 @@ base::Callback<uint32_t(const gfx::Size& size, ash::wm::WindowStateType state_type, bool resizing, - bool activated)>; + bool activated, + const gfx::Point& origin)>; void set_configure_callback(const ConfigureCallback& configure_callback) { configure_callback_ = configure_callback; }
diff --git a/components/exo/shell_surface_unittest.cc b/components/exo/shell_surface_unittest.cc index 44a0b116..45cc534 100644 --- a/components/exo/shell_surface_unittest.cc +++ b/components/exo/shell_surface_unittest.cc
@@ -41,7 +41,8 @@ const gfx::Size& size, ash::wm::WindowStateType state_type, bool resizing, - bool activated) { + bool activated, + const gfx::Point& origin) { EXPECT_EQ(ash::wm::WINDOW_STATE_TYPE_FULLSCREEN, state_type); return serial; } @@ -367,7 +368,8 @@ const gfx::Size& size, ash::wm::WindowStateType state_type, bool resizing, - bool activated) { + bool activated, + const gfx::Point& origin) { *suggested_size = size; *has_state_type = state_type; *is_resizing = resizing;
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc index 89f0382..4386237 100644 --- a/components/exo/wayland/server.cc +++ b/components/exo/wayland/server.cc
@@ -1005,7 +1005,8 @@ const gfx::Size& size, ash::wm::WindowStateType state_type, bool resizing, - bool activated) { + bool activated, + const gfx::Point& origin) { wl_shell_surface_send_configure(resource, WL_SHELL_SURFACE_RESIZE_NONE, size.width(), size.height()); wl_client_flush(wl_resource_get_client(resource)); @@ -1530,7 +1531,8 @@ const gfx::Size& size, ash::wm::WindowStateType state_type, bool resizing, - bool activated) { + bool activated, + const gfx::Point& origin) { wl_array states; wl_array_init(&states); if (state_type == ash::wm::WINDOW_STATE_TYPE_MAXIMIZED) @@ -1667,7 +1669,8 @@ const gfx::Size& size, ash::wm::WindowStateType state_type, bool resizing, - bool activated) { + bool activated, + const gfx::Point& origin) { wl_array states; wl_array_init(&states); if (state_type == ash::wm::WINDOW_STATE_TYPE_MAXIMIZED) @@ -1976,7 +1979,7 @@ void remote_surface_ack_configure(wl_client* client, wl_resource* resource, uint32_t serial) { - NOTIMPLEMENTED(); + GetUserDataAs<ShellSurface>(resource)->AcknowledgeConfigure(serial); } void remote_surface_move(wl_client* client, wl_resource* resource) { @@ -2048,9 +2051,13 @@ display::Screen::GetScreen()->RemoveObserver(this); } + bool IsMultiDisplaySupported() const { + return wl_resource_get_version(remote_shell_resource_) >= 3; + } + std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface, int container) { - return display_->CreateRemoteShellSurface(surface, container); + return display_->CreateRemoteShellSurface(surface, gfx::Point(), container); } std::unique_ptr<NotificationSurface> CreateNotificationSurface( @@ -2222,14 +2229,32 @@ wl_client_flush(wl_resource_get_client(resource)); } +uint32_t HandleRemoteSurfaceConfigureCallback( + wl_resource* resource, + const gfx::Size& size, + ash::wm::WindowStateType state_type, + bool resizing, + bool activated, + const gfx::Point& origin) { + wl_array states; + wl_array_init(&states); + uint32_t serial = wl_display_next_serial( + wl_client_get_display(wl_resource_get_client(resource))); + zcr_remote_surface_v1_send_configure(resource, origin.x(), origin.y(), + &states, serial); + wl_client_flush(wl_resource_get_client(resource)); + wl_array_release(&states); + return serial; +} + void remote_shell_get_remote_surface(wl_client* client, wl_resource* resource, uint32_t id, wl_resource* surface, uint32_t container) { - std::unique_ptr<ShellSurface> shell_surface = - GetUserDataAs<WaylandRemoteShell>(resource)->CreateShellSurface( - GetUserDataAs<Surface>(surface), RemoteSurfaceContainer(container)); + WaylandRemoteShell* shell = GetUserDataAs<WaylandRemoteShell>(resource); + std::unique_ptr<ShellSurface> shell_surface = shell->CreateShellSurface( + GetUserDataAs<Surface>(surface), RemoteSurfaceContainer(container)); if (!shell_surface) { wl_resource_post_error(resource, ZCR_REMOTE_SHELL_V1_ERROR_ROLE, "surface has already been assigned a role"); @@ -2246,6 +2271,11 @@ shell_surface->set_state_changed_callback( base::Bind(&HandleRemoteSurfaceStateChangedCallback, base::Unretained(remote_surface_resource))); + if (shell->IsMultiDisplaySupported()) { + shell_surface->set_configure_callback( + base::Bind(&HandleRemoteSurfaceConfigureCallback, + base::Unretained(remote_surface_resource))); + } SetImplementation(remote_surface_resource, &remote_surface_implementation, std::move(shell_surface));
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc index 91e7dd23..c3155e4 100644 --- a/components/metrics/metrics_service.cc +++ b/components/metrics/metrics_service.cc
@@ -173,10 +173,6 @@ const base::Feature kUMAThrottleEvents{"UMAThrottleEvents", base::FEATURE_ENABLED_BY_DEFAULT}; -bool HasUploadScheduler() { - return base::FeatureList::IsEnabled(kUploadSchedulerFeature); -} - // The delay, in seconds, after starting recording before doing expensive // initialization work. #if defined(OS_ANDROID) || defined(OS_IOS) @@ -298,24 +294,15 @@ base::Bind(&MetricsService::StartScheduledUpload, self_ptr_factory_.GetWeakPtr()); - if (HasUploadScheduler()) { - rotation_scheduler_.reset(new MetricsRotationScheduler( - upload_callback, - // MetricsServiceClient outlives MetricsService, and - // MetricsRotationScheduler is tied to the lifetime of |this|. - base::Bind(&MetricsServiceClient::GetStandardUploadInterval, - base::Unretained(client_)))); - base::Closure send_next_log_callback = base::Bind( - &MetricsService::SendNextLog, self_ptr_factory_.GetWeakPtr()); - upload_scheduler_.reset(new MetricsUploadScheduler(send_next_log_callback)); - } else { - scheduler_.reset(new MetricsReportingScheduler( - upload_callback, - // MetricsServiceClient outlives MetricsService, and - // MetricsReportingScheduler is tied to the lifetime of |this|. - base::Bind(&MetricsServiceClient::GetStandardUploadInterval, - base::Unretained(client_)))); - } + rotation_scheduler_.reset(new MetricsRotationScheduler( + upload_callback, + // MetricsServiceClient outlives MetricsService, and + // MetricsRotationScheduler is tied to the lifetime of |this|. + base::Bind(&MetricsServiceClient::GetStandardUploadInterval, + base::Unretained(client_)))); + base::Closure send_next_log_callback = + base::Bind(&MetricsService::SendNextLog, self_ptr_factory_.GetWeakPtr()); + upload_scheduler_.reset(new MetricsUploadScheduler(send_next_log_callback)); for (auto& provider : metrics_providers_) provider->Init(); @@ -459,12 +446,8 @@ #if defined(OS_ANDROID) || defined(OS_IOS) void MetricsService::OnAppEnterBackground() { - if (upload_scheduler_) { - rotation_scheduler_->Stop(); - upload_scheduler_->Stop(); - } else { - scheduler_->Stop(); - } + rotation_scheduler_->Stop(); + upload_scheduler_->Stop(); MarkAppCleanShutdownAndCommit(&clean_exit_beacon_, local_state_); @@ -644,11 +627,7 @@ NotifyOnDidCreateMetricsLog(); } - if (upload_scheduler_) { - rotation_scheduler_->InitTaskComplete(); - } else { - scheduler_->InitTaskComplete(); - } + rotation_scheduler_->InitTaskComplete(); } void MetricsService::GetUptimes(PrefService* pref, @@ -766,12 +745,8 @@ // persisted on shutdown or backgrounding. if (recording_active() && (reporting_active() || state_ < SENDING_LOGS)) { - if (upload_scheduler_) { - rotation_scheduler_->Start(); - upload_scheduler_->Start(); - } else { - scheduler_->Start(); - } + rotation_scheduler_->Start(); + upload_scheduler_->Start(); } } @@ -789,25 +764,16 @@ if (idle_since_last_transmission_ || !recording_active() || (!reporting_active() && state_ >= SENDING_LOGS)) { - if (upload_scheduler_) { - rotation_scheduler_->Stop(); - rotation_scheduler_->RotationFinished(); - } else { - scheduler_->Stop(); - scheduler_->UploadCancelled(); - } + rotation_scheduler_->Stop(); + rotation_scheduler_->RotationFinished(); return; } // If there are unsent logs, send the next one. If not, start the asynchronous // process of finalizing the current log for upload. if (state_ == SENDING_LOGS && log_store_.has_unsent_logs()) { - if (upload_scheduler_) { - upload_scheduler_->Start(); - rotation_scheduler_->RotationFinished(); - } else { - SendNextLog(); - } + upload_scheduler_->Start(); + rotation_scheduler_->RotationFinished(); } else { // There are no logs left to send, so start creating a new one. client_->CollectFinalMetricsForLog( @@ -818,24 +784,10 @@ void MetricsService::OnFinalLogInfoCollectionDone() { DVLOG(1) << "OnFinalLogInfoCollectionDone"; - if (!upload_scheduler_) { - // If somehow there is a log upload in progress, we return and hope things - // work out. The scheduler isn't informed since if this happens, the - // scheduler will get a response from the upload. - DCHECK(!log_upload_in_progress_); - if (log_upload_in_progress_) - return; - } - // Abort if metrics were turned off during the final info gathering. if (!recording_active()) { - if (upload_scheduler_) { - rotation_scheduler_->Stop(); - rotation_scheduler_->RotationFinished(); - } else { - scheduler_->Stop(); - scheduler_->UploadCancelled(); - } + rotation_scheduler_->Stop(); + rotation_scheduler_->RotationFinished(); return; } @@ -846,39 +798,22 @@ CloseCurrentLog(); OpenNewLog(); } - if (upload_scheduler_) { - HandleIdleSinceLastTransmission(true); - upload_scheduler_->Start(); - rotation_scheduler_->RotationFinished(); - } else { - SendNextLog(); - } + HandleIdleSinceLastTransmission(true); + upload_scheduler_->Start(); + rotation_scheduler_->RotationFinished(); } void MetricsService::SendNextLog() { DVLOG(1) << "SendNextLog"; - if (!upload_scheduler_) - DCHECK_EQ(SENDING_LOGS, state_); if (!reporting_active()) { - if (upload_scheduler_) { - upload_scheduler_->StopAndUploadCancelled(); - } else { - scheduler_->Stop(); - scheduler_->UploadCancelled(); - } + upload_scheduler_->StopAndUploadCancelled(); return; } if (!log_store_.has_unsent_logs()) { // Should only get here if serializing the log failed somehow. - if (upload_scheduler_) { - upload_scheduler_->Stop(); - // Reset backoff interval - upload_scheduler_->UploadFinished(true); - } else { - // Just tell the scheduler it was uploaded and wait for the next log - // interval. - scheduler_->UploadFinished(true, log_store_.has_unsent_logs()); - } + upload_scheduler_->Stop(); + // Reset backoff interval + upload_scheduler_->UploadFinished(true); return; } if (!log_store_.has_staged_log()) @@ -891,11 +826,7 @@ if (is_cellular_logic && data_use_tracker_ && !data_use_tracker_->ShouldUploadLogOnCellular( log_store_.staged_log_hash().size())) { - if (upload_scheduler_) { - upload_scheduler_->UploadOverDataUsageCap(); - } else { - scheduler_->UploadCancelled(); - } + upload_scheduler_->UploadOverDataUsageCap(); upload_canceled = true; } else { SendStagedLog(); @@ -1008,16 +939,11 @@ const std::string hash = base::HexEncode(log_store_.staged_log_hash().data(), log_store_.staged_log_hash().size()); log_uploader_->UploadLog(log_store_.staged_log(), hash); - - if (!upload_scheduler_) - HandleIdleSinceLastTransmission(true); } void MetricsService::OnLogUploadComplete(int response_code) { DVLOG(1) << "OnLogUploadComplete:" << response_code; - if (!upload_scheduler_) - DCHECK_EQ(SENDING_LOGS, state_); DCHECK(log_upload_in_progress_); log_upload_in_progress_ = false; @@ -1051,15 +977,11 @@ // Error 400 indicates a problem with the log, not with the server, so // don't consider that a sign that the server is in trouble. bool server_is_healthy = upload_succeeded || response_code == 400; - if (upload_scheduler_) { - if (!log_store_.has_unsent_logs()) { - DVLOG(1) << "Stopping upload_scheduler_"; - upload_scheduler_->Stop(); - } - upload_scheduler_->UploadFinished(server_is_healthy); - } else { - scheduler_->UploadFinished(server_is_healthy, log_store_.has_unsent_logs()); + if (!log_store_.has_unsent_logs()) { + DVLOG(1) << "Stopping upload_scheduler_"; + upload_scheduler_->Stop(); } + upload_scheduler_->UploadFinished(server_is_healthy); } void MetricsService::IncrementLongPrefsValue(const char* path) {
diff --git a/components/metrics/metrics_service.h b/components/metrics/metrics_service.h index fc23bdc..574e7be 100644 --- a/components/metrics/metrics_service.h +++ b/components/metrics/metrics_service.h
@@ -51,7 +51,6 @@ namespace metrics { class MetricsLogUploader; -class MetricsReportingScheduler; class MetricsRotationScheduler; class MetricsUploadScheduler; class MetricsServiceAccessor; @@ -421,9 +420,6 @@ // A number that identifies the how many times the app has been launched. int session_id_; - // The scheduler for determining when log rotations+uploads should happen. - // TODO(holte): Remove this once we've switched to split schedulers. - std::unique_ptr<MetricsReportingScheduler> scheduler_; // The scheduler for determining when log rotations should happen. std::unique_ptr<MetricsRotationScheduler> rotation_scheduler_; // The scheduler for determining when uploads should happen.
diff --git a/components/metrics/metrics_service_unittest.cc b/components/metrics/metrics_service_unittest.cc index 32e386f..5cc3c15 100644 --- a/components/metrics/metrics_service_unittest.cc +++ b/components/metrics/metrics_service_unittest.cc
@@ -479,33 +479,7 @@ EXPECT_TRUE(test_provider->init_called()); } -TEST_F(MetricsServiceTest, BasicRotation) { - feature_list_.InitAndDisableFeature(kUploadSchedulerFeature); - TestMetricsServiceClient client; - TestMetricsService service(GetMetricsStateManager(), &client, - GetLocalState()); - service.InitializeMetricsRecordingState(); - service.Start(); - // Should rotate, mark state idle, and start upload. - task_runner_->RunPendingTasks(); - EXPECT_TRUE(client.uploader()->is_uploading()); - EXPECT_EQ(0U, task_runner_->NumPendingTasks()); - // Should schedule next rotation on upload completion. - client.uploader()->CompleteUpload(200); - EXPECT_FALSE(client.uploader()->is_uploading()); - EXPECT_EQ(1U, task_runner_->NumPendingTasks()); - // Should cancel rotation due to being idle. - task_runner_->RunPendingTasks(); - EXPECT_FALSE(client.uploader()->is_uploading()); - EXPECT_EQ(0U, task_runner_->NumPendingTasks()); - // Should resume rotation on non-idle. - service.OnApplicationNotIdle(); - EXPECT_FALSE(client.uploader()->is_uploading()); - EXPECT_EQ(1U, task_runner_->NumPendingTasks()); -} - TEST_F(MetricsServiceTest, SplitRotation) { - feature_list_.InitAndEnableFeature(kUploadSchedulerFeature); TestMetricsServiceClient client; TestMetricsService service(GetMetricsStateManager(), &client, GetLocalState());
diff --git a/components/ntp_snippets_strings.grdp b/components/ntp_snippets_strings.grdp index e9e2ef5..25c61a7 100644 --- a/components/ntp_snippets_strings.grdp +++ b/components/ntp_snippets_strings.grdp
@@ -54,4 +54,8 @@ Your open tabs appear here </message> + <message name="IDS_NTP_NOTIFICATIONS_READ_THIS_STORY_AND_MORE" desc="When notifying the user about a news article, identifies the publisher of that article and gives the number of additional news articles that are available to read. Shown beneath the title of the article. Articles come in batches of 10, so the number of additional articles will usually be 9."> + Read stories from <ph name="ARTICLE_PUBLISHER">$1<ex>World News Corporation</ex></ph> and <ph name="OTHER_ARTICLE_COUNT">$2<ex>9</ex></ph> more + </message> + </grit-part>
diff --git a/components/offline_pages/core/downloads/download_ui_adapter.cc b/components/offline_pages/core/downloads/download_ui_adapter.cc index bfc4526f..d73ed68 100644 --- a/components/offline_pages/core/downloads/download_ui_adapter.cc +++ b/components/offline_pages/core/downloads/download_ui_adapter.cc
@@ -192,6 +192,19 @@ return 0; } +void DownloadUIAdapter::UpdateProgress(int64_t offline_id, int64_t bytes) { + for (auto& item : items_) { + if (item.second->is_request && item.second->offline_id == offline_id) { + if (bytes == item.second->ui_item->download_progress_bytes) + return; + + item.second->ui_item->download_progress_bytes = bytes; + for (Observer& observer : observers_) + observer.ItemUpdated(*(item.second->ui_item)); + } + } +} + // Note that several LoadCache calls may be issued before the async GetAllPages // comes back. void DownloadUIAdapter::LoadCache() {
diff --git a/components/offline_pages/core/downloads/download_ui_adapter.h b/components/offline_pages/core/downloads/download_ui_adapter.h index abf413a..f0ecbd6a 100644 --- a/components/offline_pages/core/downloads/download_ui_adapter.h +++ b/components/offline_pages/core/downloads/download_ui_adapter.h
@@ -95,6 +95,7 @@ // via Observer or directly by the user (as in 'open'). void DeleteItem(const std::string& guid); int64_t GetOfflineIdByGuid(const std::string& guid) const; + void UpdateProgress(int64_t offline_id, int64_t bytes); // OfflinePageModel::Observer void OfflinePageModelLoaded(OfflinePageModel* model) override;
diff --git a/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc b/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc index d74b2ed..aed1609 100644 --- a/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc +++ b/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc
@@ -455,4 +455,21 @@ EXPECT_TRUE(items_loaded); } +TEST_F(DownloadUIAdapterTest, UpdateProgress) { + offliner_stub->enable_callback(true); + AddRequest(GURL(kTestUrl), kTestClientId1); + PumpLoop(); + + int64_t offline_id = adapter->GetOfflineIdByGuid(kTestGuid1); + const DownloadUIItem* item = adapter->GetItem(kTestGuid1); + + ASSERT_NE(nullptr, item); + EXPECT_EQ(item->download_progress_bytes, 0); + updated_guids.clear(); + + adapter->UpdateProgress(offline_id, 15); + EXPECT_EQ(kTestGuid1, updated_guids[0]); + EXPECT_EQ(item->download_progress_bytes, 15); +} + } // namespace offline_pages
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index 2ba6a8a..4528511 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn
@@ -53,6 +53,8 @@ "builtin_provider.h", "clipboard_url_provider.cc", "clipboard_url_provider.h", + "features.cc", + "features.h", "history_provider.cc", "history_provider.h", "history_quick_provider.cc",
diff --git a/components/omnibox/browser/features.cc b/components/omnibox/browser/features.cc new file mode 100644 index 0000000..4ab8d4a --- /dev/null +++ b/components/omnibox/browser/features.cc
@@ -0,0 +1,13 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/omnibox/browser/features.h" + +namespace features { + +// Feature used for the Zero Suggest Redirect to Chrome Field Trial. +const base::Feature kZeroSuggestRedirectToChrome{ + "ZeroSuggestRedirectToChrome", base::FEATURE_DISABLED_BY_DEFAULT}; + +} // namespace features
diff --git a/components/omnibox/browser/features.h b/components/omnibox/browser/features.h new file mode 100644 index 0000000..06b9d2a --- /dev/null +++ b/components/omnibox/browser/features.h
@@ -0,0 +1,16 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_OMNIBOX_BROWSER_FEATURES_H_ +#define COMPONENTS_OMNIBOX_BROWSER_FEATURES_H_ + +#include "base/feature_list.h" + +namespace features { + +extern const base::Feature kZeroSuggestRedirectToChrome; + +} // namespace features + +#endif // COMPONENTS_OMNIBOX_BROWSER_FEATURES_H_
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc index ef1e0e4..935e2b1 100644 --- a/components/omnibox/browser/omnibox_field_trial.cc +++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -17,6 +17,7 @@ #include "base/time/time.h" #include "build/build_config.h" #include "components/metrics/proto/omnibox_event.pb.h" +#include "components/omnibox/browser/features.h" #include "components/omnibox/browser/omnibox_switches.h" #include "components/omnibox/browser/url_index_private_data.h" #include "components/search/search.h" @@ -46,10 +47,6 @@ // Field trial names. const char kStopTimerFieldTrialName[] = "OmniboxStopTimer"; -// Feature used for the Zero Suggest Redirect to Chrome Field Trial. -const base::Feature kZeroSuggestRedirectToChrome{ - "ZeroSuggestRedirectToChrome", base::FEATURE_DISABLED_BY_DEFAULT}; - void InitializeBucketsFromString(const std::string& bucket_string, ScoreBuckets* score_buckets) { // Clear the buckets. @@ -592,20 +589,20 @@ // static bool OmniboxFieldTrial::InZeroSuggestRedirectToChromeFieldTrial() { - return base::FeatureList::IsEnabled(kZeroSuggestRedirectToChrome); + return base::FeatureList::IsEnabled(features::kZeroSuggestRedirectToChrome); } // static std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeServerAddress() { return base::GetFieldTrialParamValueByFeature( - kZeroSuggestRedirectToChrome, + features::kZeroSuggestRedirectToChrome, kZeroSuggestRedirectToChromeServerAddressParam); } // static std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeAdditionalFields() { return base::GetFieldTrialParamValueByFeature( - kZeroSuggestRedirectToChrome, + features::kZeroSuggestRedirectToChrome, kZeroSuggestRedirectToChromeAdditionalFieldsParam); }
diff --git a/components/precache/core/precache_fetcher.cc b/components/precache/core/precache_fetcher.cc index e84c4d5..91065992 100644 --- a/components/precache/core/precache_fetcher.cc +++ b/components/precache/core/precache_fetcher.cc
@@ -22,6 +22,7 @@ #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/metrics/histogram_macros.h" +#include "base/optional.h" #include "base/sha1.h" #include "base/strings/string_piece.h" #include "base/task_runner_util.h" @@ -125,18 +126,38 @@ } // Returns the resource selection bitset from the |manifest| for the given -// |experiment_id|. By default all resource will be selected if the experiment -// group is not found. -uint64_t GetResourceBitset(const PrecacheManifest& manifest, - uint32_t experiment_id) { +// |experiment_id|. If the experiment group is not found, then this returns +// nullopt, in which case all resources should be selected. +base::Optional<std::vector<bool>> GetResourceBitset( + const PrecacheManifest& manifest, + uint32_t experiment_id) { + base::Optional<std::vector<bool>> ret; if (manifest.has_experiments()) { const auto& resource_bitset_map = manifest.experiments().resources_by_experiment_group(); - const auto& resource_bitset_it = resource_bitset_map.find(experiment_id); - if (resource_bitset_it != resource_bitset_map.end()) - return resource_bitset_it->second.bitset(); + const auto& it = resource_bitset_map.find(experiment_id); + if (it != resource_bitset_map.end()) { + if (it->second.has_bitset()) { + const std::string& bitset = it->second.bitset(); + ret.emplace(bitset.size() * 8); + for (size_t i = 0; i < bitset.size(); ++i) { + for (size_t j = 0; j < 8; ++j) { + if ((1 << j) & bitset[i]) + ret.value()[i * 8 + j] = true; + } + } + } else if (it->second.has_deprecated_bitset()) { + uint64_t bitset = it->second.deprecated_bitset(); + ret.emplace(64); + for (int i = 0; i < 64; ++i) { + if ((0x1ULL << i) & bitset) + ret.value()[i] = true; + } + } + } } - return ~0ULL; + // Only return one variable to ensure RVO triggers. + return ret; } // URLFetcherResponseWriter that ignores the response body, in order to avoid @@ -746,10 +767,10 @@ const int32_t len = std::min(manifest.resource_size(), unfinished_work_->config_settings().top_resources_count()); - const uint64_t resource_bitset = + const base::Optional<std::vector<bool>> resource_bitset = GetResourceBitset(manifest, experiment_id_); for (int i = 0; i < len; ++i) { - if (((0x1ULL << i) & resource_bitset) && + if ((!resource_bitset.has_value() || resource_bitset.value()[i]) && manifest.resource(i).has_url()) { GURL url(manifest.resource(i).url()); if (url.is_valid()) {
diff --git a/components/precache/core/precache_fetcher_unittest.cc b/components/precache/core/precache_fetcher_unittest.cc index f42c6c39..374e0b0 100644 --- a/components/precache/core/precache_fetcher_unittest.cc +++ b/components/precache/core/precache_fetcher_unittest.cc
@@ -576,7 +576,28 @@ histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 1); } -TEST_F(PrecacheFetcherTest, PrecacheResourceSelection) { +class PrecacheFetcherResourceSelectionTest + : public PrecacheFetcherTest, + public testing::WithParamInterface<PrecacheResourceSelection> { + public: + // These bitsets are asymmetric and multibyte, in order to test the orderings. + + // Set bits for kGoodResourceURL, kGoodResourceURLC and kGoodResourceURLD. + static PrecacheResourceSelection DeprecatedBitset() { + PrecacheResourceSelection ret; + ret.set_deprecated_bitset(0b110000000001); + return ret; + } + + // Set bits for kGoodResourceURL, kGoodResourceURLC and kGoodResourceURLD. + static PrecacheResourceSelection Bitset() { + PrecacheResourceSelection ret; + ret.set_bitset("\x01\x0c"); + return ret; + } +}; + +TEST_P(PrecacheFetcherResourceSelectionTest, Basic) { SetDefaultFlags(); std::unique_ptr<PrecacheUnfinishedWork> unfinished_work( @@ -590,15 +611,13 @@ PrecacheResourceSelection resource_selection; good_manifest.add_resource()->set_url(kGoodResourceURL); good_manifest.add_resource()->set_url(kGoodResourceURLA); - good_manifest.add_resource()->set_url(kGoodResourceURLB); + for (int i = 0; i < 8; ++i) + good_manifest.add_resource()->set_url(kGoodResourceURLB); good_manifest.add_resource()->set_url(kGoodResourceURLC); good_manifest.add_resource()->set_url(kGoodResourceURLD); - // Set bits for kGoodResourceURL, kGoodResourceURLB and kGoodResourceURLD. - resource_selection.set_bitset(0b10101); (*good_manifest.mutable_experiments() - ->mutable_resources_by_experiment_group())[kExperimentID] = - resource_selection; + ->mutable_resources_by_experiment_group())[kExperimentID] = GetParam(); factory_.SetFakeResponse(GURL(kConfigURL), config.SerializeAsString(), net::HTTP_OK, net::URLRequestStatus::SUCCESS); @@ -607,7 +626,7 @@ net::URLRequestStatus::SUCCESS); factory_.SetFakeResponse(GURL(kGoodResourceURL), "good", net::HTTP_OK, net::URLRequestStatus::SUCCESS); - factory_.SetFakeResponse(GURL(kGoodResourceURLB), "good URL B", net::HTTP_OK, + factory_.SetFakeResponse(GURL(kGoodResourceURLC), "good URL B", net::HTTP_OK, net::URLRequestStatus::SUCCESS); factory_.SetFakeResponse(GURL(kGoodResourceURLD), "good URL D", net::HTTP_OK, net::URLRequestStatus::SUCCESS); @@ -630,7 +649,7 @@ expected_requested_urls.emplace_back(kConfigURL); expected_requested_urls.emplace_back(kGoodManifestURL); expected_requested_urls.emplace_back(kGoodResourceURL); - expected_requested_urls.emplace_back(kGoodResourceURLB); + expected_requested_urls.emplace_back(kGoodResourceURLC); expected_requested_urls.emplace_back(kGoodResourceURLD); EXPECT_EQ(expected_requested_urls, url_callback_.requested_urls()); @@ -643,7 +662,7 @@ histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 1); } -TEST_F(PrecacheFetcherTest, PrecacheResourceSelectionMissingBitset) { +TEST_P(PrecacheFetcherResourceSelectionTest, MissingBitset) { SetDefaultFlags(); std::unique_ptr<PrecacheUnfinishedWork> unfinished_work( @@ -662,10 +681,9 @@ good_manifest.add_resource()->set_url(kGoodResourceURLD); // Set bits for a different experiment group. - resource_selection.set_bitset(0b1); (*good_manifest.mutable_experiments() ->mutable_resources_by_experiment_group())[kExperimentID + 1] = - resource_selection; + GetParam(); // Resource selection bitset for the experiment group will be missing and all // resources will be fetched. @@ -718,6 +736,12 @@ histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 1); } +INSTANTIATE_TEST_CASE_P( + PrecacheFetcherResourceSelectionTest, + PrecacheFetcherResourceSelectionTest, + testing::Values(PrecacheFetcherResourceSelectionTest::DeprecatedBitset(), + PrecacheFetcherResourceSelectionTest::Bitset())); + TEST_F(PrecacheFetcherTest, PrecachePauseResume) { SetDefaultFlags();
diff --git a/components/precache/core/proto/precache.proto b/components/precache/core/proto/precache.proto index dd80621..d0bebd2 100644 --- a/components/precache/core/proto/precache.proto +++ b/components/precache/core/proto/precache.proto
@@ -45,17 +45,29 @@ map<fixed32, PrecacheResourceSelection> resources_by_experiment_group = 1; }; +// Determines which of the resources in the manifest should be selected. message PrecacheResourceSelection { - // Select the resources as a std::bitset over the resources listed in the - // manifest. + // A bitset over the resources listed in the manifest. Bits correspond to + // resource position in LSB-to-MSB order, as in: // - // The bitset should be loaded as: - // std::bitset selection(resource_selection.bitset()); - // Then manifest.resource(i) is selected for the experiment iff - // selection.test(i). + // if ((0x1ULL << i) && DEPRECATED_bitset) IncludeResource(i); // - // A missing bitset means that the experiment applies to all the resources. - optional fixed64 bitset = 1 [default = 0xFFFFFFFFFFFFFFFF]; + // Deprecated because it only supports up to 64 resources. + optional fixed64 DEPRECATED_bitset = 1 + [default = 0xFFFFFFFFFFFFFFFF, deprecated = true]; + + // A bitset over the resources listed in the manifest. Bits correspond to + // resource position. Bytes are ordered little-endian, and bits within each + // byte are ordered LSB-to-MSB. The resulting bitstream is of mixed order, + // but easy to test: + // + // if ((1 << (i % 8)) & bitset[i / 8]) IncludeResource(i); + // + // Takes precedence over DEPRECATED_bitset, if both are present. + optional bytes bitset = 2; + + // A PrecacheResourceSelection without DEPRECATED_bitset or bitset means that + // all resources should be selected. }; message PrecacheConfigurationSettings {
diff --git a/components/profile_metrics/OWNERS b/components/profile_metrics/OWNERS index 367bb85d..e43d48c 100644 --- a/components/profile_metrics/OWNERS +++ b/components/profile_metrics/OWNERS
@@ -1,3 +1,5 @@ anthonyvd@chromium.org erg@chromium.org mlerman@chromium.org + +# COMPONENT: UI>Browser>Profiles
diff --git a/components/spellcheck/renderer/spellcheck_provider.cc b/components/spellcheck/renderer/spellcheck_provider.cc index 8e7758bf..2f9c7df 100644 --- a/components/spellcheck/renderer/spellcheck_provider.cc +++ b/components/spellcheck/renderer/spellcheck_provider.cc
@@ -300,6 +300,8 @@ const base::string16& text, WebTextCheckingCompletion* completion) { size_t last_length = last_request_.length(); + if (!last_length) + return false; // Send back the |last_results_| if the |last_request_| is a substring of // |text| and |text| does not have more words to check. Provider cannot cancel @@ -314,15 +316,8 @@ completion->didFinishCheckingText(last_results_); return true; } - int code = 0; - int length = static_cast<int>(text_length); - U16_PREV(text.data(), 0, length, code); - UErrorCode error = U_ZERO_ERROR; - if (uscript_getScript(code, &error) != USCRIPT_COMMON) { - completion->didCancelCheckingText(); - return true; - } } + // Create a subset of the cached results and return it if the given text is a // substring of the cached text. if (text_length < last_length &&
diff --git a/components/spellcheck/renderer/spellcheck_provider.h b/components/spellcheck/renderer/spellcheck_provider.h index fd849f4..9852af5 100644 --- a/components/spellcheck/renderer/spellcheck_provider.h +++ b/components/spellcheck/renderer/spellcheck_provider.h
@@ -42,7 +42,9 @@ ~SpellCheckProvider() override; // Requests async spell and grammar checker to the platform text - // checker, which is available on the browser process. + // checker, which is available on the browser process. The function does not + // have special handling for partial words, as Blink guarantees that no + // request is made when typing in the middle of a word. void RequestTextChecking( const base::string16& text, blink::WebTextCheckingCompletion* completion,
diff --git a/components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc b/components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc index 3ada8e9..29003699 100644 --- a/components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc +++ b/components/spellcheck/renderer/spellcheck_provider_hunspell_unittest.cc
@@ -39,19 +39,12 @@ std::vector<SpellCheckMarker>()); EXPECT_TRUE(provider_.text_.empty()); - // Verify that the SpellCheckProvider class does not spellcheck text while we - // are typing a word. + // Verify that the SpellCheckProvider class spellcheck the first word when we + // stop typing after finishing the first word. provider_.ResetResult(); provider_.RequestTextChecking(ASCIIToUTF16("First"), &completion, std::vector<SpellCheckMarker>()); - EXPECT_TRUE(provider_.text_.empty()); - - // Verify that the SpellCheckProvider class spellcheck the first word when we - // type a space key, i.e. when we finish typing a word. - provider_.ResetResult(); - provider_.RequestTextChecking(ASCIIToUTF16("First "), &completion, - std::vector<SpellCheckMarker>()); - EXPECT_EQ(ASCIIToUTF16("First "), provider_.text_); + EXPECT_EQ(ASCIIToUTF16("First"), provider_.text_); // Verify that the SpellCheckProvider class spellcheck the first line when we // type a return key, i.e. when we finish typing a line. @@ -142,27 +135,4 @@ << text << "\""; } -// Tests that the SpellCheckProvider cancels spelling requests in the middle of -// a word. -TEST_F(SpellCheckProviderTest, CancelMidWordRequests) { - FakeTextCheckingCompletion completion; - provider_.RequestTextChecking(ASCIIToUTF16("hello "), &completion, - std::vector<SpellCheckMarker>()); - EXPECT_EQ(completion.completion_count_, 1U); - EXPECT_EQ(completion.cancellation_count_, 0U); - EXPECT_EQ(provider_.spelling_service_call_count_, 1U); - - provider_.RequestTextChecking(ASCIIToUTF16("hello world"), &completion, - std::vector<SpellCheckMarker>()); - EXPECT_EQ(completion.completion_count_, 2U); - EXPECT_EQ(completion.cancellation_count_, 1U); - EXPECT_EQ(provider_.spelling_service_call_count_, 1U); - - provider_.RequestTextChecking(ASCIIToUTF16("hello world."), &completion, - std::vector<SpellCheckMarker>()); - EXPECT_EQ(completion.completion_count_, 3U); - EXPECT_EQ(completion.cancellation_count_, 1U); - EXPECT_EQ(provider_.spelling_service_call_count_, 2U); -} - } // namespace
diff --git a/components/sync/engine_impl/syncer.cc b/components/sync/engine_impl/syncer.cc index 76b7da3..5d28f4a9 100644 --- a/components/sync/engine_impl/syncer.cc +++ b/components/sync/engine_impl/syncer.cc
@@ -82,6 +82,14 @@ VLOG(1) << "Configuring types " << ModelTypeSetToString(request_types); HandleCycleBegin(cycle); ConfigureGetUpdatesDelegate configure_delegate(source); + + // It is possible during shutdown that datatypes get unregistered from + // ModelTypeRegistry before scheduled configure sync cycle gets executed. + // When it happens we should adjust set of types to download to only include + // registered types. + if (cancelation_signal_->IsSignalled()) + request_types.RetainAll(cycle->context()->GetEnabledTypes()); + GetUpdatesProcessor get_updates_processor( cycle->context()->model_type_registry()->update_handler_map(), configure_delegate);
diff --git a/components/sync/engine_impl/syncer_unittest.cc b/components/sync/engine_impl/syncer_unittest.cc index a66b784..ca131a0e 100644 --- a/components/sync/engine_impl/syncer_unittest.cc +++ b/components/sync/engine_impl/syncer_unittest.cc
@@ -251,10 +251,13 @@ } bool SyncShareConfigure() { + return SyncShareConfigureTypes(context_->GetEnabledTypes()); + } + + bool SyncShareConfigureTypes(ModelTypeSet types) { ResetCycle(); return syncer_->ConfigureSyncShare( - context_->GetEnabledTypes(), - sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, cycle_.get()); + types, sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, cycle_.get()); } void SetUp() override { @@ -5019,6 +5022,19 @@ mock_server_->ClearUpdatesQueue(); } +// Tests that, after shutdown initiated, if set of types to download includes +// unregistered type, DCHECK doesn't get triggered. +TEST_F(SyncerTest, ConfigureUnregisteredTypesDuringShutdown) { + // Signal that shutdown is initiated. + cancelation_signal_.Signal(); + + // Simulate type being unregistered before configuration by including type + // that isn't registered with ModelTypeRegistry. + SyncShareConfigureTypes(ModelTypeSet(APPS)); + + // No explicit verification, DCHECK shouldn't have been triggered. +} + TEST_F(SyncerTest, GetKeySuccess) { { syncable::ReadTransaction rtrans(FROM_HERE, directory());
diff --git a/components/tracing/common/process_metrics_memory_dump_provider.cc b/components/tracing/common/process_metrics_memory_dump_provider.cc index 9bfe0a4..e181786 100644 --- a/components/tracing/common/process_metrics_memory_dump_provider.cc +++ b/components/tracing/common/process_metrics_memory_dump_provider.cc
@@ -38,6 +38,15 @@ #include "base/numerics/safe_math.h" #endif // defined(OS_MACOSX) +#if defined(OS_WIN) +#include <psapi.h> +#include <tchar.h> +#include <windows.h> + +#include <base/strings/sys_string_conversions.h> +#include <base/win/win_util.h> +#endif // defined(OS_WIN) + namespace tracing { namespace { @@ -233,6 +242,37 @@ } #endif // defined(OS_LINUX) || defined(OS_ANDROID) +#if defined(OS_WIN) +bool ProcessMetricsMemoryDumpProvider::DumpProcessMemoryMaps( + const base::trace_event::MemoryDumpArgs& args, + base::trace_event::ProcessMemoryDump* pmd) { + std::vector<HMODULE> modules; + if (!base::win::GetLoadedModulesSnapshot(::GetCurrentProcess(), &modules)) + return false; + + // Query the base address for each module, and attach it to the dump. + for (size_t i = 0; i < modules.size(); ++i) { + wchar_t module_name[MAX_PATH]; + if (!::GetModuleFileName(modules[i], module_name, MAX_PATH)) + continue; + + MODULEINFO module_info; + if (!::GetModuleInformation(::GetCurrentProcess(), modules[i], + &module_info, sizeof(MODULEINFO))) { + continue; + } + base::trace_event::ProcessMemoryMaps::VMRegion region; + region.size_in_bytes = module_info.SizeOfImage; + region.mapped_file = base::SysWideToNativeMB(module_name); + region.start_address = reinterpret_cast<uint64_t>(module_info.lpBaseOfDll); + pmd->process_mmaps()->AddVMRegion(region); + } + if (!pmd->process_mmaps()->vm_regions().empty()) + pmd->set_has_process_mmaps(); + return true; +} +#endif // defined(OS_WIN) + #if defined(OS_MACOSX) namespace { @@ -547,11 +587,9 @@ base::trace_event::ProcessMemoryDump* pmd) { bool res = DumpProcessTotals(args, pmd); -#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_MACOSX) if (args.level_of_detail == base::trace_event::MemoryDumpLevelOfDetail::DETAILED) res &= DumpProcessMemoryMaps(args, pmd); -#endif // defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_MACOSX) return res; }
diff --git a/components/tracing/common/process_metrics_memory_dump_provider.h b/components/tracing/common/process_metrics_memory_dump_provider.h index ec1a9d6..6534f18 100644 --- a/components/tracing/common/process_metrics_memory_dump_provider.h +++ b/components/tracing/common/process_metrics_memory_dump_provider.h
@@ -48,7 +48,10 @@ TestMachOReading); FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest, NoDuplicateRegions); -#endif // defined(OS_MACOSX) +#elif defined(OS_WIN) + FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest, + TestWinModuleReading); +#endif ProcessMetricsMemoryDumpProvider(base::ProcessId process);
diff --git a/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc b/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc index d05c3a7..95a565d 100644 --- a/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc +++ b/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc
@@ -22,6 +22,10 @@ #include <mach-o/dyld.h> #endif +#if defined(OS_WIN) +#include <base/strings/sys_string_conversions.h> +#endif + namespace tracing { #if defined(OS_LINUX) || defined(OS_ANDROID) @@ -274,6 +278,56 @@ #endif } +#if defined(OS_WIN) + +void DummyFunction() {} + +TEST(ProcessMetricsMemoryDumpProviderTest, TestWinModuleReading) { + using VMRegion = base::trace_event::ProcessMemoryMaps::VMRegion; + + ProcessMetricsMemoryDumpProvider mdp(base::kNullProcessId); + base::trace_event::MemoryDumpArgs args; + base::trace_event::ProcessMemoryDump dump(nullptr, args); + ASSERT_TRUE(mdp.DumpProcessMemoryMaps(args, &dump)); + ASSERT_TRUE(dump.has_process_mmaps()); + + wchar_t module_name[MAX_PATH]; + DWORD result = GetModuleFileName(nullptr, module_name, MAX_PATH); + ASSERT_TRUE(result); + std::string executable_name = base::SysWideToNativeMB(module_name); + + HMODULE module_containing_dummy = nullptr; + uintptr_t dummy_function_address = + reinterpret_cast<uintptr_t>(&DummyFunction); + result = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + reinterpret_cast<LPCWSTR>(dummy_function_address), + &module_containing_dummy); + ASSERT_TRUE(result); + result = GetModuleFileName(nullptr, module_name, MAX_PATH); + ASSERT_TRUE(result); + std::string module_containing_dummy_name = + base::SysWideToNativeMB(module_name); + + bool found_executable = false; + bool found_region_with_dummy = false; + for (const VMRegion& region : dump.process_mmaps()->vm_regions()) { + EXPECT_NE(0u, region.start_address); + EXPECT_NE(0u, region.size_in_bytes); + + if (region.mapped_file.find(executable_name) != std::string::npos) + found_executable = true; + + if (dummy_function_address >= region.start_address && + dummy_function_address < region.start_address + region.size_in_bytes) { + found_region_with_dummy = true; + EXPECT_EQ(module_containing_dummy_name, region.mapped_file); + } + } + EXPECT_TRUE(found_executable); + EXPECT_TRUE(found_region_with_dummy); +} +#endif + #if defined(OS_MACOSX) TEST(ProcessMetricsMemoryDumpProviderTest, TestMachOReading) { using VMRegion = base::trace_event::ProcessMemoryMaps::VMRegion;
diff --git a/content/browser/renderer_host/delegated_frame_host.cc b/content/browser/renderer_host/delegated_frame_host.cc index 6e291141..4a2c3b2 100644 --- a/content/browser/renderer_host/delegated_frame_host.cc +++ b/content/browser/renderer_host/delegated_frame_host.cc
@@ -443,7 +443,6 @@ surface_returned_resources_.clear(); last_compositor_frame_sink_id_ = compositor_frame_sink_id; } - bool skip_frame = false; pending_delegated_ack_count_++; background_color_ = frame.metadata.root_background_color; @@ -464,7 +463,6 @@ gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) { - skip_frame = true; skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), frame.metadata.latency_info.begin(), frame.metadata.latency_info.end()); @@ -476,11 +474,8 @@ skipped_latency_info_list_.clear(); } - cc::SurfaceFactory::DrawCallback ack_callback; - if (!skip_frame) { - ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, AsWeakPtr(), - compositor_frame_sink_id); - } + auto ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, + AsWeakPtr(), compositor_frame_sink_id); surface_factory_->SubmitCompositorFrame(local_surface_id_, std::move(frame), ack_callback); if (allocated_new_local_surface_id) { @@ -505,12 +500,7 @@ damage_rect_in_dip); } - if (skip_frame) { - SendReclaimCompositorResources(compositor_frame_sink_id, - true /* is_swap_ack */); - } - - if (compositor_ && !skip_frame) + if (compositor_) can_lock_compositor_ = NO_PENDING_COMMIT; if (local_surface_id_.is_valid()) {
diff --git a/content/child/v8_value_converter_impl.cc b/content/child/v8_value_converter_impl.cc index 86554c33..50dde0fd 100644 --- a/content/child/v8_value_converter_impl.cc +++ b/content/child/v8_value_converter_impl.cc
@@ -184,6 +184,7 @@ reg_exp_allowed_(false), function_allowed_(false), strip_null_from_objects_(false), + convert_negative_zero_to_int_(false), avoid_identity_hash_for_testing_(false), strategy_(NULL) {} @@ -203,6 +204,10 @@ strip_null_from_objects_ = val; } +void V8ValueConverterImpl::SetConvertNegativeZeroToInt(bool val) { + convert_negative_zero_to_int_ = val; +} + void V8ValueConverterImpl::SetStrategy(Strategy* strategy) { strategy_ = strategy; } @@ -373,6 +378,11 @@ double val_as_double = val.As<v8::Number>()->Value(); if (!std::isfinite(val_as_double)) return nullptr; + // Normally, this would be an integer, and fall into IsInt32(). But if the + // value is -0, it's treated internally as a double. Consumers are allowed + // to ignore this esoterica and treat it as an integer. + if (convert_negative_zero_to_int_ && val_as_double == 0.0) + return base::MakeUnique<base::FundamentalValue>(0); return base::MakeUnique<base::FundamentalValue>(val_as_double); }
diff --git a/content/child/v8_value_converter_impl.h b/content/child/v8_value_converter_impl.h index 0cc996e4..1fbc9892 100644 --- a/content/child/v8_value_converter_impl.h +++ b/content/child/v8_value_converter_impl.h
@@ -30,6 +30,7 @@ void SetRegExpAllowed(bool val) override; void SetFunctionAllowed(bool val) override; void SetStripNullFromObjects(bool val) override; + void SetConvertNegativeZeroToInt(bool val) override; void SetStrategy(Strategy* strategy) override; v8::Local<v8::Value> ToV8Value( const base::Value* value, @@ -87,6 +88,9 @@ // into Values. bool strip_null_from_objects_; + // If true, convert -0 to an integer value (instead of a double). + bool convert_negative_zero_to_int_; + bool avoid_identity_hash_for_testing_; // Strategy object that changes the converter's behavior.
diff --git a/content/child/v8_value_converter_impl_unittest.cc b/content/child/v8_value_converter_impl_unittest.cc index 84d03fc..c08bc57 100644 --- a/content/child/v8_value_converter_impl_unittest.cc +++ b/content/child/v8_value_converter_impl_unittest.cc
@@ -952,6 +952,37 @@ EXPECT_TRUE(base::Value::Equals(&empty, current)) << *current; } +TEST_F(V8ValueConverterImplTest, NegativeZero) { + v8::HandleScope handle_scope(isolate_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); + v8::MicrotasksScope microtasks(isolate_, + v8::MicrotasksScope::kDoNotRunMicrotasks); + + v8::Context::Scope context_scope(context); + const char* source = "(function() { return -0; })();"; + + v8::Local<v8::Script> script( + v8::Script::Compile(v8::String::NewFromUtf8(isolate_, source))); + v8::Local<v8::Value> value = script->Run(); + ASSERT_FALSE(value.IsEmpty()); + + { + V8ValueConverterImpl converter; + std::unique_ptr<base::Value> result = converter.FromV8Value(value, context); + ASSERT_TRUE(result->is_double()) + << base::Value::GetTypeName(result->type()); + EXPECT_EQ(0, result->GetDouble()); + } + { + V8ValueConverterImpl converter; + converter.SetConvertNegativeZeroToInt(true); + std::unique_ptr<base::Value> result = converter.FromV8Value(value, context); + ASSERT_TRUE(result->is_int()) << base::Value::GetTypeName(result->type()); + EXPECT_EQ(0, result->GetInt()); + } +} + class V8ValueConverterOverridingStrategyForTesting : public V8ValueConverter::Strategy { public:
diff --git a/content/ppapi_plugin/broker_process_dispatcher.cc b/content/ppapi_plugin/broker_process_dispatcher.cc index a6e5ba6..87babc1 100644 --- a/content/ppapi_plugin/broker_process_dispatcher.cc +++ b/content/ppapi_plugin/broker_process_dispatcher.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/debug/dump_without_crashing.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "content/child/child_process.h" @@ -119,14 +118,6 @@ if (!peer_is_browser_) { // We might want to consider killing the peer instead is we see problems in // the future. - if (msg.type() == PpapiMsg_GetSitesWithData::ID || - msg.type() == PpapiMsg_ClearSiteData::ID || - msg.type() == PpapiMsg_DeauthorizeContentLicenses::ID || - msg.type() == PpapiMsg_GetPermissionSettings::ID || - msg.type() == PpapiMsg_SetDefaultPermission::ID || - msg.type() == PpapiMsg_SetSitePermission::ID) { - base::debug::DumpWithoutCrashing(); - } return false; }
diff --git a/content/public/child/v8_value_converter.h b/content/public/child/v8_value_converter.h index 9afeb397..f53c7c6 100644 --- a/content/public/child/v8_value_converter.h +++ b/content/public/child/v8_value_converter.h
@@ -100,6 +100,9 @@ // converting arguments to extension APIs. virtual void SetStripNullFromObjects(bool val) = 0; + // If true, treats -0 as an integer. Otherwise, -0 is converted to a double. + virtual void SetConvertNegativeZeroToInt(bool val) = 0; + // Extend default behavior of V8ValueConverter. virtual void SetStrategy(Strategy* strategy) = 0;
diff --git a/content/public/test/android/BUILD.gn b/content/public/test/android/BUILD.gn index 2d1af8a..91d05b2 100644 --- a/content/public/test/android/BUILD.gn +++ b/content/public/test/android/BUILD.gn
@@ -29,6 +29,7 @@ java_files = [ "javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java", "javatests/src/org/chromium/content/browser/test/util/ApplicationUtils.java", + "javatests/src/org/chromium/content/browser/test/util/ClickUtils.java", "javatests/src/org/chromium/content/browser/test/util/Criteria.java", "javatests/src/org/chromium/content/browser/test/util/CriteriaHelper.java", "javatests/src/org/chromium/content/browser/test/util/DOMUtils.java",
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/ClickUtils.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/ClickUtils.java new file mode 100644 index 0000000..89894d0 --- /dev/null +++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/ClickUtils.java
@@ -0,0 +1,100 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.content.browser.test.util; + +import android.app.Instrumentation; +import android.os.SystemClock; +import android.view.MotionEvent; +import android.view.View; + +import org.chromium.base.ThreadUtils; + +/** + * Test utils for clicking and other mouse actions. + */ +public class ClickUtils { + /** + * Click a button. Unlike {@link ClickUtils#mouseSingleClickView} this directly accesses + * the view and does not send motion events though the message queue. As such it doesn't require + * the view to have been created by the instrumented activity, but gives less flexibility than + * mouseSingleClickView. For example, if the view is hierachical, then clickButton will always + * act on specified view, whereas mouseSingleClickView will send the events to the appropriate + * child view. It is hence only really appropriate for simple views such as buttons. + * + * @param button the button to be clicked. + */ + public static void clickButton(final View button) { + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + // Post the actual click to the button's message queue, to ensure that it has been + // inflated before the click is received. + button.post(new Runnable() { + @Override + public void run() { + button.performClick(); + } + }); + } + }); + } + + /** + * Sends (synchronously) a single mouse click to the View at the specified coordinates. + * + * @param instrumentation Instrumentation object used by the test. + * @param v The view the coordinates are relative to. + * @param x Relative x location to the view. + * @param y Relative y location to the view. + */ + public static void mouseSingleClickView(Instrumentation instrumentation, View v, int x, int y) { + int location[] = TestTouchUtils.getAbsoluteLocationFromRelative(v, x, y); + int absoluteX = location[0]; + int absoluteY = location[1]; + mouseSingleClick(instrumentation, absoluteX, absoluteY); + } + + /** + * Sends (synchronously) a single mouse click to the center of the View. + * + * @param instrumentation Instrumentation object used by the test. + * @param v The view the coordinates are relative to. + */ + public static void mouseSingleClickView(Instrumentation instrumentation, View v) { + int x = v.getWidth() / 2; + int y = v.getHeight() / 2; + mouseSingleClickView(instrumentation, v, x, y); + } + + private static void sendMouseAction( + Instrumentation instrumentation, int action, long downTime, float x, float y) { + long eventTime = SystemClock.uptimeMillis(); + MotionEvent.PointerCoords coords[] = new MotionEvent.PointerCoords[1]; + coords[0] = new MotionEvent.PointerCoords(); + coords[0].x = x; + coords[0].y = y; + MotionEvent.PointerProperties properties[] = new MotionEvent.PointerProperties[1]; + properties[0] = new MotionEvent.PointerProperties(); + properties[0].id = 0; + properties[0].toolType = MotionEvent.TOOL_TYPE_FINGER; + MotionEvent event = MotionEvent.obtain( + downTime, eventTime, action, 1, properties, coords, 0, 0, 0.0f, 0.0f, 0, 0, 0, 0); + instrumentation.sendPointerSync(event); + instrumentation.waitForIdleSync(); + } + + /** + * Sends (synchronously) a single mouse click to an absolute screen coordinates. + * + * @param instrumentation Instrumentation object used by the test. + * @param x Screen absolute x location. + * @param y Screen absolute y location. + */ + private static void mouseSingleClick(Instrumentation instrumentation, float x, float y) { + long downTime = SystemClock.uptimeMillis(); + sendMouseAction(instrumentation, MotionEvent.ACTION_DOWN, downTime, x, y); + sendMouseAction(instrumentation, MotionEvent.ACTION_UP, downTime, x, y); + } +}
diff --git a/docs/testing/web_platform_tests.md b/docs/testing/web_platform_tests.md index e3e07a3..a5d90685 100644 --- a/docs/testing/web_platform_tests.md +++ b/docs/testing/web_platform_tests.md
@@ -101,6 +101,11 @@ --tests-root=LayoutTests/external/wpt ``` +Note: the `--work` argument is important even if you have no local changes. +Without it the `manifest` script will try to generate a manifest for all files +in the Chromium tree and take a very long time. +See [wpt-tools issue #171](https://github.com/w3c/wpt-tools/issues/171). + Most tests are written using testharness.js, see [Writing Layout Tests](./writing_layout_tests.md) and [Layout Tests Tips](./layout_tests_tips.md) for general guidelines.
diff --git a/extensions/renderer/resources/schema_utils.js b/extensions/renderer/resources/schema_utils.js index 1d1023a0..8f8e26a 100644 --- a/extensions/renderer/resources/schema_utils.js +++ b/extensions/renderer/resources/schema_utils.js
@@ -117,9 +117,6 @@ var normalizedArgs = []; var ai = 0; for (var si = 0; si < definedSignature.length; ++si) { - // Handle integer -0 as 0. - if (JSONSchemaValidator.getType(args[ai]) === 'integer' && args[ai] === 0) - args[ai] = 0; if (definedSignature[si] === resolvedSignature[ai]) $Array.push(normalizedArgs, args[ai++]); else
diff --git a/extensions/renderer/send_request_natives.cc b/extensions/renderer/send_request_natives.cc index 4a32814..5824bc0 100644 --- a/extensions/renderer/send_request_natives.cc +++ b/extensions/renderer/send_request_natives.cc
@@ -48,6 +48,9 @@ // we shouldn't really be doing it (e.g. for the sake of the storage API). converter->SetFunctionAllowed(true); + // See http://crbug.com/694248. + converter->SetConvertNegativeZeroToInt(true); + if (!preserve_null_in_objects) converter->SetStripNullFromObjects(true);
diff --git a/gpu/command_buffer/common/capabilities.h b/gpu/command_buffer/common/capabilities.h index b190dcc9..15de84c5 100644 --- a/gpu/command_buffer/common/capabilities.h +++ b/gpu/command_buffer/common/capabilities.h
@@ -140,7 +140,7 @@ bool blend_equation_advanced_coherent = false; bool texture_rg = false; bool texture_half_float_linear = false; - bool color_buffer_float = false; + bool color_buffer_half_float_rgba = false; bool image_ycbcr_422 = false; bool image_ycbcr_420v = false; bool render_buffer_format_bgra8888 = false;
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index 3bb365a..6c078a4 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc
@@ -50,6 +50,7 @@ adjusted_disallowed_features.chromium_color_buffer_float_rgba = true; adjusted_disallowed_features.chromium_color_buffer_float_rgb = true; adjusted_disallowed_features.ext_color_buffer_float = true; + adjusted_disallowed_features.ext_color_buffer_half_float = true; adjusted_disallowed_features.oes_texture_float_linear = true; } return adjusted_disallowed_features;
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index 8646fd2..5d7e214 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc
@@ -37,7 +37,9 @@ size_t count; }; -class StringSet { +} // anonymous namespace. + +class FeatureInfo::StringSet { public: StringSet() {} @@ -64,11 +66,11 @@ string_set_.insert(tokens.begin(), tokens.end()); } - bool Contains(const char* s) { + bool Contains(const char* s) const { return string_set_.find(s) != string_set_.end(); } - bool Contains(const std::string& s) { + bool Contains(const std::string& s) const { return string_set_.find(s) != string_set_.end(); } @@ -80,6 +82,8 @@ std::set<std::string> string_set_; }; +namespace { + class ScopedPixelUnpackBufferOverride { public: explicit ScopedPixelUnpackBufferOverride( @@ -236,6 +240,21 @@ feature_flags_.enable_color_buffer_float = true; } +void FeatureInfo::EnableEXTColorBufferHalfFloat() { + AddExtensionString("GL_EXT_color_buffer_half_float"); + validators_.render_buffer_format.AddValue(GL_R16F); + validators_.render_buffer_format.AddValue(GL_RG16F); + validators_.render_buffer_format.AddValue(GL_RGB16F); + validators_.render_buffer_format.AddValue(GL_RGBA16F); + validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R16F); + validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG16F); + validators_.texture_sized_color_renderable_internal_format.AddValue( + GL_RGB16F); + validators_.texture_sized_color_renderable_internal_format.AddValue( + GL_RGBA16F); + feature_flags_.enable_color_buffer_half_float = true; +} + void FeatureInfo::EnableCHROMIUMColorBufferFloatRGBA() { if (!feature_flags_.chromium_color_buffer_float_rgba) return; @@ -655,6 +674,19 @@ } } + if (enable_texture_storage) { + feature_flags_.ext_texture_storage = true; + AddExtensionString("GL_EXT_texture_storage"); + validators_.texture_parameter.AddValue(GL_TEXTURE_IMMUTABLE_FORMAT_EXT); + if (enable_texture_format_bgra8888) { + validators_.texture_internal_format_storage.AddValue(GL_BGRA8_EXT); + validators_.texture_sized_color_renderable_internal_format.AddValue( + GL_BGRA8_EXT); + validators_.texture_sized_texture_filterable_internal_format.AddValue( + GL_BGRA8_EXT); + } + } + if (enable_texture_format_bgra8888) { feature_flags_.ext_texture_format_bgra8888 = true; AddExtensionString("GL_EXT_texture_format_BGRA8888"); @@ -725,171 +757,7 @@ feature_flags_.npot_ok = true; } - // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float, - // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear - bool enable_texture_float = false; - bool enable_texture_float_linear = false; - bool enable_texture_half_float = false; - bool enable_texture_half_float_linear = false; - bool enable_ext_color_buffer_float = false; - - bool may_enable_chromium_color_buffer_float = false; - - // This extension allows a variety of floating point formats to be - // rendered to via framebuffer objects. - if (extensions.Contains("GL_EXT_color_buffer_float")) { - enable_ext_color_buffer_float = true; - } - - if (extensions.Contains("GL_ARB_texture_float") || - gl_version_info_->is_desktop_core_profile) { - enable_texture_float = true; - enable_texture_float_linear = true; - enable_texture_half_float = true; - enable_texture_half_float_linear = true; - may_enable_chromium_color_buffer_float = true; - } else { - // GLES3 adds support for Float type by default but it doesn't support all - // formats as GL_OES_texture_float(i.e.LUMINANCE_ALPHA,LUMINANCE and Alpha) - if (extensions.Contains("GL_OES_texture_float")) { - enable_texture_float = true; - if (extensions.Contains("GL_OES_texture_float_linear")) { - enable_texture_float_linear = true; - } - - if (enable_ext_color_buffer_float || gl_version_info_->is_angle) { - may_enable_chromium_color_buffer_float = true; - } - } - - // TODO(dshwang): GLES3 supports half float by default but GL_HALF_FLOAT_OES - // isn't equal to GL_HALF_FLOAT. - if (extensions.Contains("GL_OES_texture_half_float")) { - enable_texture_half_float = true; - if (extensions.Contains("GL_OES_texture_half_float_linear")) { - enable_texture_half_float_linear = true; - } - } - } - - if (enable_texture_float) { - validators_.pixel_type.AddValue(GL_FLOAT); - validators_.read_pixel_type.AddValue(GL_FLOAT); - AddExtensionString("GL_OES_texture_float"); - if (enable_texture_float_linear) { - oes_texture_float_linear_available_ = true; - if (!disallowed_features_.oes_texture_float_linear) - EnableOESTextureFloatLinear(); - } - } - - if (enable_texture_half_float) { - validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); - validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES); - AddExtensionString("GL_OES_texture_half_float"); - if (enable_texture_half_float_linear) { - oes_texture_half_float_linear_available_ = true; - if (!disallowed_features_.oes_texture_half_float_linear) - EnableOESTextureHalfFloatLinear(); - } - } - - if (may_enable_chromium_color_buffer_float) { - static_assert(GL_RGBA32F_ARB == GL_RGBA32F && - GL_RGBA32F_EXT == GL_RGBA32F && - GL_RGB32F_ARB == GL_RGB32F && - GL_RGB32F_EXT == GL_RGB32F, - "sized float internal format variations must match"); - // We don't check extension support beyond ARB_texture_float on desktop GL, - // and format support varies between GL configurations. For example, spec - // prior to OpenGL 3.0 mandates framebuffer support only for one - // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not - // support rendering to RGB32F. Check for framebuffer completeness with - // formats that the extensions expose, and only enable an extension when a - // framebuffer created with its texture format is reported as complete. - GLint fb_binding = 0; - GLint tex_binding = 0; - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fb_binding); - glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex_binding); - - GLuint tex_id = 0; - GLuint fb_id = 0; - GLsizei width = 16; - - glGenTextures(1, &tex_id); - glGenFramebuffersEXT(1, &fb_id); - glBindTexture(GL_TEXTURE_2D, tex_id); - // Nearest filter needed for framebuffer completeness on some drivers. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, width, 0, GL_RGBA, - GL_FLOAT, NULL); - glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, tex_id, 0); - GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, - GL_FLOAT, NULL); - GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); - - // For desktop systems, check to see if we support rendering to the full - // range of formats supported by EXT_color_buffer_float - if (status_rgba == GL_FRAMEBUFFER_COMPLETE && enable_es3) { - bool full_float_support = true; - - glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width, 0, GL_RED, - GL_FLOAT, NULL); - full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == - GL_FRAMEBUFFER_COMPLETE; - glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width, 0, GL_RG, - GL_FLOAT, NULL); - full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == - GL_FRAMEBUFFER_COMPLETE; - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, width, 0, GL_RGBA, - GL_FLOAT, NULL); - full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == - GL_FRAMEBUFFER_COMPLETE; - glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, width, width, 0, GL_RED, - GL_FLOAT, NULL); - full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == - GL_FRAMEBUFFER_COMPLETE; - glTexImage2D(GL_TEXTURE_2D, 0, GL_RG32F, width, width, 0, GL_RG, - GL_FLOAT, NULL); - full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == - GL_FRAMEBUFFER_COMPLETE; - glTexImage2D(GL_TEXTURE_2D, 0, GL_R11F_G11F_B10F, width, width, 0, GL_RGB, - GL_FLOAT, NULL); - full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == - GL_FRAMEBUFFER_COMPLETE; - - enable_ext_color_buffer_float = full_float_support; - } - - glDeleteFramebuffersEXT(1, &fb_id); - glDeleteTextures(1, &tex_id); - - glBindFramebufferEXT(GL_FRAMEBUFFER, static_cast<GLuint>(fb_binding)); - glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(tex_binding)); - - DCHECK(glGetError() == GL_NO_ERROR); - - if (status_rgba == GL_FRAMEBUFFER_COMPLETE) { - feature_flags_.chromium_color_buffer_float_rgba = true; - if (!disallowed_features_.chromium_color_buffer_float_rgba) - EnableCHROMIUMColorBufferFloatRGBA(); - } - if (status_rgb == GL_FRAMEBUFFER_COMPLETE) { - feature_flags_.chromium_color_buffer_float_rgb = true; - if (!disallowed_features_.chromium_color_buffer_float_rgb) - EnableCHROMIUMColorBufferFloatRGB(); - } - } - - // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 - if (enable_ext_color_buffer_float && enable_es3) { - ext_color_buffer_float_available_ = true; - if (!disallowed_features_.ext_color_buffer_float) - EnableEXTColorBufferFloat(); - } + InitializeFloatAndHalfFloatFeatures(extensions); // Check for multisample support if (!workarounds_.disable_chromium_framebuffer_multisample) { @@ -1083,37 +951,6 @@ validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); } - if (enable_texture_storage) { - feature_flags_.ext_texture_storage = true; - AddExtensionString("GL_EXT_texture_storage"); - validators_.texture_parameter.AddValue(GL_TEXTURE_IMMUTABLE_FORMAT_EXT); - if (enable_texture_format_bgra8888) { - validators_.texture_internal_format_storage.AddValue(GL_BGRA8_EXT); - validators_.texture_sized_color_renderable_internal_format.AddValue( - GL_BGRA8_EXT); - validators_.texture_sized_texture_filterable_internal_format.AddValue( - GL_BGRA8_EXT); - } - if (enable_texture_float) { - validators_.texture_internal_format_storage.AddValue(GL_RGBA32F_EXT); - validators_.texture_internal_format_storage.AddValue(GL_RGB32F_EXT); - validators_.texture_internal_format_storage.AddValue(GL_ALPHA32F_EXT); - validators_.texture_internal_format_storage.AddValue( - GL_LUMINANCE32F_EXT); - validators_.texture_internal_format_storage.AddValue( - GL_LUMINANCE_ALPHA32F_EXT); - } - if (enable_texture_half_float) { - validators_.texture_internal_format_storage.AddValue(GL_RGBA16F_EXT); - validators_.texture_internal_format_storage.AddValue(GL_RGB16F_EXT); - validators_.texture_internal_format_storage.AddValue(GL_ALPHA16F_EXT); - validators_.texture_internal_format_storage.AddValue( - GL_LUMINANCE16F_EXT); - validators_.texture_internal_format_storage.AddValue( - GL_LUMINANCE_ALPHA16F_EXT); - } - } - bool have_occlusion_query = gl_version_info_->IsAtLeastGLES(3, 0) || gl_version_info_->IsAtLeastGL(3, 3); @@ -1418,6 +1255,214 @@ extensions.Contains("GL_ANGLE_client_arrays"); } +void FeatureInfo::InitializeFloatAndHalfFloatFeatures( + const StringSet& extensions) { + // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float, + // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear + bool enable_texture_float = false; + bool enable_texture_float_linear = false; + bool enable_texture_half_float = false; + bool enable_texture_half_float_linear = false; + bool enable_ext_color_buffer_float = false; + bool enable_ext_color_buffer_half_float = false; + + bool may_enable_chromium_color_buffer_float = false; + + bool enable_es3 = IsWebGL2OrES3Context(); + + // These extensions allow a variety of floating point formats to be + // rendered to via framebuffer objects. + if (extensions.Contains("GL_EXT_color_buffer_float")) + enable_ext_color_buffer_float = true; + if (extensions.Contains("GL_EXT_color_buffer_half_float")) + enable_ext_color_buffer_half_float = true; + + if (extensions.Contains("GL_ARB_texture_float") || + gl_version_info_->is_desktop_core_profile) { + enable_texture_float = true; + enable_texture_float_linear = true; + enable_texture_half_float = true; + enable_texture_half_float_linear = true; + may_enable_chromium_color_buffer_float = true; + } else { + // GLES3 adds support for Float type by default but it doesn't support all + // formats as GL_OES_texture_float(i.e.LUMINANCE_ALPHA,LUMINANCE and Alpha) + if (extensions.Contains("GL_OES_texture_float")) { + enable_texture_float = true; + if (extensions.Contains("GL_OES_texture_float_linear")) { + enable_texture_float_linear = true; + } + + if (enable_ext_color_buffer_float || gl_version_info_->is_angle) { + may_enable_chromium_color_buffer_float = true; + } + } + + // TODO(dshwang): GLES3 supports half float by default but GL_HALF_FLOAT_OES + // isn't equal to GL_HALF_FLOAT. + if (extensions.Contains("GL_OES_texture_half_float")) { + enable_texture_half_float = true; + if (extensions.Contains("GL_OES_texture_half_float_linear")) { + enable_texture_half_float_linear = true; + } + } + } + + if (enable_texture_float) { + validators_.pixel_type.AddValue(GL_FLOAT); + validators_.read_pixel_type.AddValue(GL_FLOAT); + AddExtensionString("GL_OES_texture_float"); + if (enable_texture_float_linear) { + oes_texture_float_linear_available_ = true; + if (!disallowed_features_.oes_texture_float_linear) + EnableOESTextureFloatLinear(); + } + } + + if (enable_texture_half_float) { + validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); + validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES); + AddExtensionString("GL_OES_texture_half_float"); + if (enable_texture_half_float_linear) { + oes_texture_half_float_linear_available_ = true; + if (!disallowed_features_.oes_texture_half_float_linear) + EnableOESTextureHalfFloatLinear(); + } + } + + if (may_enable_chromium_color_buffer_float) { + static_assert(GL_RGBA32F_ARB == GL_RGBA32F && + GL_RGBA32F_EXT == GL_RGBA32F && + GL_RGB32F_ARB == GL_RGB32F && GL_RGB32F_EXT == GL_RGB32F, + "sized float internal format variations must match"); + // We don't check extension support beyond ARB_texture_float on desktop GL, + // and format support varies between GL configurations. For example, spec + // prior to OpenGL 3.0 mandates framebuffer support only for one + // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not + // support rendering to RGB32F. Check for framebuffer completeness with + // formats that the extensions expose, and only enable an extension when a + // framebuffer created with its texture format is reported as complete. + GLint fb_binding = 0; + GLint tex_binding = 0; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fb_binding); + glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex_binding); + + GLuint tex_id = 0; + GLuint fb_id = 0; + GLsizei width = 16; + + glGenTextures(1, &tex_id); + glGenFramebuffersEXT(1, &fb_id); + glBindTexture(GL_TEXTURE_2D, tex_id); + // Nearest filter needed for framebuffer completeness on some drivers. + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, width, 0, GL_RGBA, + GL_FLOAT, NULL); + glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, tex_id, 0); + GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, GL_FLOAT, + NULL); + GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); + + // For desktop systems, check to see if we support rendering to the full + // range of formats supported by EXT_color_buffer_float + if (status_rgba == GL_FRAMEBUFFER_COMPLETE && enable_es3) { + bool full_float_support = true; + GLenum internal_formats[] = { + GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_R11F_G11F_B10F, + }; + GLenum formats[] = { + GL_RED, GL_RG, GL_RGBA, GL_RED, GL_RG, GL_RGB, + }; + DCHECK_EQ(arraysize(internal_formats), arraysize(formats)); + for (size_t i = 0; i < arraysize(formats); ++i) { + glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0, + formats[i], GL_FLOAT, NULL); + full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == + GL_FRAMEBUFFER_COMPLETE; + } + enable_ext_color_buffer_float = full_float_support; + } + // Likewise for EXT_color_buffer_half_float on ES2 contexts. + if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float) { + bool full_half_float_support = true; + GLenum internal_formats[] = { + GL_R16F, GL_RG16F, GL_RGBA16F, + }; + GLenum formats[] = { + GL_RED, GL_RG, GL_RGBA, + }; + GLenum data_type = GL_FLOAT; + if (gl_version_info_->is_es2) + data_type = GL_HALF_FLOAT_OES; + if (gl_version_info_->is_es3) + data_type = GL_HALF_FLOAT; + DCHECK_EQ(arraysize(internal_formats), arraysize(formats)); + for (size_t i = 0; i < arraysize(formats); ++i) { + glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0, + formats[i], data_type, NULL); + full_half_float_support &= + glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == + GL_FRAMEBUFFER_COMPLETE; + } + enable_ext_color_buffer_half_float = full_half_float_support; + } + + glDeleteFramebuffersEXT(1, &fb_id); + glDeleteTextures(1, &tex_id); + + glBindFramebufferEXT(GL_FRAMEBUFFER, static_cast<GLuint>(fb_binding)); + glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(tex_binding)); + + DCHECK_EQ(glGetError(), static_cast<GLuint>(GL_NO_ERROR)); + + if (status_rgba == GL_FRAMEBUFFER_COMPLETE) { + feature_flags_.chromium_color_buffer_float_rgba = true; + if (!disallowed_features_.chromium_color_buffer_float_rgba) + EnableCHROMIUMColorBufferFloatRGBA(); + } + if (status_rgb == GL_FRAMEBUFFER_COMPLETE) { + feature_flags_.chromium_color_buffer_float_rgb = true; + if (!disallowed_features_.chromium_color_buffer_float_rgb) + EnableCHROMIUMColorBufferFloatRGB(); + } + } + + // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 + if (enable_ext_color_buffer_float && enable_es3) { + ext_color_buffer_float_available_ = true; + if (!disallowed_features_.ext_color_buffer_float) + EnableEXTColorBufferFloat(); + } + + // Enable GL_EXT_color_buffer_half_float if we have found the capability. + if (enable_ext_color_buffer_half_float && + !disallowed_features_.ext_color_buffer_half_float) { + EnableEXTColorBufferHalfFloat(); + } + + if (feature_flags_.ext_texture_storage) { + if (enable_texture_float) { + validators_.texture_internal_format_storage.AddValue(GL_RGBA32F_EXT); + validators_.texture_internal_format_storage.AddValue(GL_RGB32F_EXT); + validators_.texture_internal_format_storage.AddValue(GL_ALPHA32F_EXT); + validators_.texture_internal_format_storage.AddValue(GL_LUMINANCE32F_EXT); + validators_.texture_internal_format_storage.AddValue( + GL_LUMINANCE_ALPHA32F_EXT); + } + if (enable_texture_half_float) { + validators_.texture_internal_format_storage.AddValue(GL_RGBA16F_EXT); + validators_.texture_internal_format_storage.AddValue(GL_RGB16F_EXT); + validators_.texture_internal_format_storage.AddValue(GL_ALPHA16F_EXT); + validators_.texture_internal_format_storage.AddValue(GL_LUMINANCE16F_EXT); + validators_.texture_internal_format_storage.AddValue( + GL_LUMINANCE_ALPHA16F_EXT); + } + } +} + bool FeatureInfo::IsES3Capable() const { if (workarounds_.disable_texture_storage) return false;
diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index fa0da85f..a2a7f51 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h
@@ -53,6 +53,7 @@ bool enable_texture_float_linear = false; bool enable_texture_half_float_linear = false; bool enable_color_buffer_float = false; + bool enable_color_buffer_half_float = false; bool angle_translated_shader_source = false; bool angle_pack_reverse_row_order = false; bool arb_texture_rectangle = false; @@ -167,6 +168,7 @@ void EnableCHROMIUMColorBufferFloatRGBA(); void EnableCHROMIUMColorBufferFloatRGB(); void EnableEXTColorBufferFloat(); + void EnableEXTColorBufferHalfFloat(); void EnableOESTextureFloatLinear(); void EnableOESTextureHalfFloatLinear(); @@ -181,12 +183,14 @@ private: friend class base::RefCounted<FeatureInfo>; friend class BufferManagerClientSideArraysTest; + class StringSet; ~FeatureInfo(); void AddExtensionString(const char* s); void InitializeBasicState(const base::CommandLine* command_line); void InitializeFeatures(); + void InitializeFloatAndHalfFloatFeatures(const StringSet& extensions); Validators validators_;
diff --git a/gpu/command_buffer/service/framebuffer_manager.cc b/gpu/command_buffer/service/framebuffer_manager.cc index 6391295..55ed2e1 100644 --- a/gpu/command_buffer/service/framebuffer_manager.cc +++ b/gpu/command_buffer/service/framebuffer_manager.cc
@@ -269,6 +269,10 @@ internal_format == GL_LUMINANCE_ALPHA) { return false; } + // Disallow RGB16F, because it is only supported in ES2 and not ES3. + if (internal_format == GL_RGB16F) { + return false; + } return (need & have) != 0; }
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 344671b..67eab70d 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3745,8 +3745,9 @@ caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; caps.texture_half_float_linear = feature_info_->feature_flags().enable_texture_half_float_linear; - caps.color_buffer_float = - feature_info_->feature_flags().enable_color_buffer_float; + caps.color_buffer_half_float_rgba = + feature_info_->feature_flags().enable_color_buffer_float || + feature_info_->feature_flags().enable_color_buffer_half_float; caps.image_ycbcr_422 = feature_info_->feature_flags().chromium_image_ycbcr_422; caps.image_ycbcr_420v =
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index ae2269517..c53b522 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -54,31 +54,25 @@ struct ContextState; struct DisallowedFeatures { - DisallowedFeatures() - : gpu_memory_manager(false), - npot_support(false), - chromium_color_buffer_float_rgba(false), - chromium_color_buffer_float_rgb(false), - ext_color_buffer_float(false), - oes_texture_float_linear(false), - oes_texture_half_float_linear(false) { - } + DisallowedFeatures() {} void AllowExtensions() { chromium_color_buffer_float_rgba = false; chromium_color_buffer_float_rgb = false; ext_color_buffer_float = false; + ext_color_buffer_half_float = false; oes_texture_float_linear = false; oes_texture_half_float_linear = false; } - bool gpu_memory_manager; - bool npot_support; - bool chromium_color_buffer_float_rgba; - bool chromium_color_buffer_float_rgb; - bool ext_color_buffer_float; - bool oes_texture_float_linear; - bool oes_texture_half_float_linear; + bool gpu_memory_manager = false; + bool npot_support = false; + bool chromium_color_buffer_float_rgba = false; + bool chromium_color_buffer_float_rgb = false; + bool ext_color_buffer_float = false; + bool ext_color_buffer_half_float = false; + bool oes_texture_float_linear = false; + bool oes_texture_half_float_linear = false; }; typedef base::Callback<void(const std::string& key,
diff --git a/gpu/command_buffer/service/test_helper.cc b/gpu/command_buffer/service/test_helper.cc index b5fa864..dc4e3ac 100644 --- a/gpu/command_buffer/service/test_helper.cc +++ b/gpu/command_buffer/service/test_helper.cc
@@ -638,6 +638,32 @@ .RetiresOnSaturation(); } + if (!enable_es3 && !strstr(extensions, "GL_EXT_color_buffer_half_float")) { + EXPECT_CALL( + *gl, + TexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width, 0, GL_RED, _, _)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL( + *gl, + TexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width, 0, GL_RG, _, _)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*gl, + TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, width, 0, + GL_RGBA, _, _)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) + .Times(1) + .RetiresOnSaturation(); + } EXPECT_CALL(*gl, DeleteFramebuffersEXT(1, _)) .Times(1)
diff --git a/gpu/ipc/common/gpu_command_buffer_traits_multi.h b/gpu/ipc/common/gpu_command_buffer_traits_multi.h index 33fa07b6f..bb52e5b 100644 --- a/gpu/ipc/common/gpu_command_buffer_traits_multi.h +++ b/gpu/ipc/common/gpu_command_buffer_traits_multi.h
@@ -111,7 +111,7 @@ IPC_STRUCT_TRAITS_MEMBER(blend_equation_advanced_coherent) IPC_STRUCT_TRAITS_MEMBER(texture_rg) IPC_STRUCT_TRAITS_MEMBER(texture_half_float_linear) - IPC_STRUCT_TRAITS_MEMBER(color_buffer_float) + IPC_STRUCT_TRAITS_MEMBER(color_buffer_half_float_rgba) IPC_STRUCT_TRAITS_MEMBER(image_ycbcr_422) IPC_STRUCT_TRAITS_MEMBER(image_ycbcr_420v) IPC_STRUCT_TRAITS_MEMBER(render_buffer_format_bgra8888)
diff --git a/ios/chrome/browser/browser_state_metrics/OWNERS b/ios/chrome/browser/browser_state_metrics/OWNERS index 367bb85d..e43d48c 100644 --- a/ios/chrome/browser/browser_state_metrics/OWNERS +++ b/ios/chrome/browser/browser_state_metrics/OWNERS
@@ -1,3 +1,5 @@ anthonyvd@chromium.org erg@chromium.org mlerman@chromium.org + +# COMPONENT: UI>Browser>Profiles
diff --git a/ios/chrome/browser/payments/BUILD.gn b/ios/chrome/browser/payments/BUILD.gn index 52cdde4..aa274121 100644 --- a/ios/chrome/browser/payments/BUILD.gn +++ b/ios/chrome/browser/payments/BUILD.gn
@@ -11,6 +11,7 @@ } source_set("payments") { + configs += [ "//build/config/compiler:enable_arc" ] sources = [ "js_payment_request_manager.h", "js_payment_request_manager.mm",
diff --git a/ios/chrome/browser/payments/js_payment_request_manager.mm b/ios/chrome/browser/payments/js_payment_request_manager.mm index cd8cb5c1..48337a4 100644 --- a/ios/chrome/browser/payments/js_payment_request_manager.mm +++ b/ios/chrome/browser/payments/js_payment_request_manager.mm
@@ -10,6 +10,10 @@ #include "base/values.h" #include "ios/web/public/payments/payment_request.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // Sanitizes |JSON| and wraps it in quotes so it can be injected safely in
diff --git a/ios/chrome/browser/payments/payment_items_display_coordinator.mm b/ios/chrome/browser/payments/payment_items_display_coordinator.mm index daa6779..b6b23da 100644 --- a/ios/chrome/browser/payments/payment_items_display_coordinator.mm +++ b/ios/chrome/browser/payments/payment_items_display_coordinator.mm
@@ -4,13 +4,15 @@ #import "ios/chrome/browser/payments/payment_items_display_coordinator.h" -#import "base/ios/weak_nsobject.h" -#include "base/mac/scoped_nsobject.h" +#include "base/logging.h" #include "ios/web/public/payments/payment_request.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + @interface PaymentItemsDisplayCoordinator () { - base::WeakNSProtocol<id<PaymentItemsDisplayCoordinatorDelegate>> _delegate; - base::scoped_nsobject<PaymentItemsDisplayViewController> _viewController; + PaymentItemsDisplayViewController* _viewController; } @end @@ -18,20 +20,13 @@ @implementation PaymentItemsDisplayCoordinator @synthesize paymentRequest = _paymentRequest; - -- (id<PaymentItemsDisplayCoordinatorDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate:(id<PaymentItemsDisplayCoordinatorDelegate>)delegate { - _delegate.reset(delegate); -} +@synthesize delegate = _delegate; - (void)start { BOOL payButtonEnabled = _paymentRequest->selected_credit_card() != nil; - _viewController.reset([[PaymentItemsDisplayViewController alloc] + _viewController = [[PaymentItemsDisplayViewController alloc] initWithPaymentRequest:_paymentRequest - payButtonEnabled:payButtonEnabled]); + payButtonEnabled:payButtonEnabled]; [_viewController setDelegate:self]; [_viewController loadModel]; @@ -44,7 +39,7 @@ - (void)stop { [[self baseViewController].navigationController popViewControllerAnimated:YES]; - _viewController.reset(); + _viewController = nil; } #pragma mark - PaymentItemsDisplayViewControllerDelegate
diff --git a/ios/chrome/browser/payments/payment_items_display_view_controller.mm b/ios/chrome/browser/payments/payment_items_display_view_controller.mm index 53c03ed..afc96455 100644 --- a/ios/chrome/browser/payments/payment_items_display_view_controller.mm +++ b/ios/chrome/browser/payments/payment_items_display_view_controller.mm
@@ -4,9 +4,7 @@ #import "ios/chrome/browser/payments/payment_items_display_view_controller.h" -#import "base/ios/weak_nsobject.h" #include "base/mac/foundation_util.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/credit_card.h" @@ -23,6 +21,10 @@ #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoFontLoader.h" #include "ui/base/l10n/l10n_util.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + NSString* const kPaymentItemsDisplayCollectionViewId = @"kPaymentItemsDisplayCollectionViewId"; NSString* const kPaymentItemsDisplayItemId = @"kPaymentItemsDisplayItemId"; @@ -44,8 +46,7 @@ } // namespace @interface PaymentItemsDisplayViewController () { - base::WeakNSProtocol<id<PaymentItemsDisplayViewControllerDelegate>> _delegate; - base::scoped_nsobject<MDCFlatButton> _payButton; + MDCFlatButton* _payButton; // The PaymentRequest object owning an instance of web::PaymentRequest as // provided by the page invoking the Payment Request API. This is a weak @@ -62,6 +63,7 @@ @end @implementation PaymentItemsDisplayViewController +@synthesize delegate = _delegate; - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest payButtonEnabled:(BOOL)payButtonEnabled { @@ -80,7 +82,7 @@ [self navigationItem].leftBarButtonItem = returnButton; // Set up right (pay) button. - _payButton.reset([[MDCFlatButton alloc] init]); + _payButton = [[MDCFlatButton alloc] init]; [_payButton setTitle:l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_PAY_BUTTON) forState:UIControlStateNormal]; @@ -102,8 +104,7 @@ // height of the bar. We don't want that for the button so we use a UIView // here to contain the button instead and the button is vertically centered // inside the full bar height. - UIView* buttonView = - [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; + UIView* buttonView = [[UIView alloc] initWithFrame:CGRectZero]; [buttonView addSubview:_payButton]; // Navigation bar button items are aligned with the trailing edge of the // screen. Make the enclosing view larger here. The pay button will be @@ -115,7 +116,7 @@ buttonView.bounds = buttonViewBounds; UIBarButtonItem* payButtonItem = - [[[UIBarButtonItem alloc] initWithCustomView:buttonView] autorelease]; + [[UIBarButtonItem alloc] initWithCustomView:buttonView]; [self navigationItem].rightBarButtonItem = payButtonItem; _paymentRequest = paymentRequest; @@ -123,14 +124,6 @@ return self; } -- (id<PaymentItemsDisplayViewControllerDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate:(id<PaymentItemsDisplayViewControllerDelegate>)delegate { - _delegate.reset(delegate); -} - - (void)onReturn { [_payButton setEnabled:NO]; [_delegate paymentItemsDisplayViewControllerDidReturn:self]; @@ -150,7 +143,7 @@ // Add the total entry. PriceItem* totalItem = - [[[PriceItem alloc] initWithType:ItemTypePaymentItemTotal] autorelease]; + [[PriceItem alloc] initWithType:ItemTypePaymentItemTotal]; totalItem.accessibilityIdentifier = kPaymentItemsDisplayItemId; totalItem.item = base::SysUTF16ToNSString(_paymentRequest->payment_details().total.label); @@ -168,7 +161,7 @@ for (const auto& paymentItem : _paymentRequest->payment_details().display_items) { PriceItem* paymentItemItem = - [[[PriceItem alloc] initWithType:ItemTypePaymentItem] autorelease]; + [[PriceItem alloc] initWithType:ItemTypePaymentItem]; paymentItemItem.accessibilityIdentifier = kPaymentItemsDisplayItemId; paymentItemItem.item = base::SysUTF16ToNSString(paymentItem.label); payments::CurrencyFormatter* currencyFormatter =
diff --git a/ios/chrome/browser/payments/payment_method_selection_coordinator.mm b/ios/chrome/browser/payments/payment_method_selection_coordinator.mm index 6cf1de3..a6a614ac 100644 --- a/ios/chrome/browser/payments/payment_method_selection_coordinator.mm +++ b/ios/chrome/browser/payments/payment_method_selection_coordinator.mm
@@ -4,15 +4,16 @@ #import "ios/chrome/browser/payments/payment_method_selection_coordinator.h" -#import "base/ios/weak_nsobject.h" -#include "base/mac/scoped_nsobject.h" #include "components/autofill/core/browser/credit_card.h" #include "ios/chrome/browser/payments/payment_request.h" -@interface PaymentMethodSelectionCoordinator () { - base::WeakNSProtocol<id<PaymentMethodSelectionCoordinatorDelegate>> _delegate; - base::scoped_nsobject<PaymentMethodSelectionViewController> _viewController; -} +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface PaymentMethodSelectionCoordinator () +@property(nonatomic, strong) + PaymentMethodSelectionViewController* viewController; // Called when the user selects a payment method. The cell is checked, the // UI is locked so that the user can't interact with it, then the delegate is @@ -23,20 +24,13 @@ @end @implementation PaymentMethodSelectionCoordinator - @synthesize paymentRequest = _paymentRequest; - -- (id<PaymentMethodSelectionCoordinatorDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate:(id<PaymentMethodSelectionCoordinatorDelegate>)delegate { - _delegate.reset(delegate); -} +@synthesize delegate = _delegate; +@synthesize viewController = _viewController; - (void)start { - _viewController.reset([[PaymentMethodSelectionViewController alloc] - initWithPaymentRequest:_paymentRequest]); + _viewController = [[PaymentMethodSelectionViewController alloc] + initWithPaymentRequest:_paymentRequest]; [_viewController setDelegate:self]; [_viewController loadModel]; @@ -49,7 +43,7 @@ - (void)stop { [[self baseViewController].navigationController popViewControllerAnimated:YES]; - _viewController.reset(); + _viewController = nil; } #pragma mark - PaymentMethodSelectionViewControllerDelegate @@ -67,22 +61,17 @@ } - (void)delayedNotifyDelegateOfSelection:(autofill::CreditCard*)paymentMethod { - _viewController.get().view.userInteractionEnabled = NO; - base::WeakNSObject<PaymentMethodSelectionCoordinator> weakSelf(self); - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, - static_cast<int64_t>(0.2 * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - base::scoped_nsobject<PaymentMethodSelectionCoordinator> strongSelf( - [weakSelf retain]); - // Early return if the coordinator has been deallocated. - if (!strongSelf) - return; - - _viewController.get().view.userInteractionEnabled = YES; - [_delegate paymentMethodSelectionCoordinator:self - didSelectPaymentMethod:paymentMethod]; - }); + _viewController.view.userInteractionEnabled = NO; + __weak PaymentMethodSelectionCoordinator* weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, + static_cast<int64_t>(0.2 * NSEC_PER_SEC)), + dispatch_get_main_queue(), ^{ + PaymentMethodSelectionCoordinator* strongSelf = weakSelf; + strongSelf.viewController.view.userInteractionEnabled = YES; + [strongSelf.delegate + paymentMethodSelectionCoordinator:strongSelf + didSelectPaymentMethod:paymentMethod]; + }); } @end
diff --git a/ios/chrome/browser/payments/payment_method_selection_view_controller.mm b/ios/chrome/browser/payments/payment_method_selection_view_controller.mm index 2ab51c9..e68e3fa 100644 --- a/ios/chrome/browser/payments/payment_method_selection_view_controller.mm +++ b/ios/chrome/browser/payments/payment_method_selection_view_controller.mm
@@ -4,9 +4,7 @@ #import "ios/chrome/browser/payments/payment_method_selection_view_controller.h" -#import "base/ios/weak_nsobject.h" #include "base/mac/foundation_util.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "components/autofill/core/browser/autofill_data_util.h" #include "components/autofill/core/browser/credit_card.h" @@ -27,6 +25,10 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + NSString* const kPaymentMethodSelectionCollectionViewId = @"kPaymentMethodSelectionCollectionViewId"; @@ -46,16 +48,13 @@ } // namespace @interface PaymentMethodSelectionViewController () { - base::WeakNSProtocol<id<PaymentMethodSelectionViewControllerDelegate>> - _delegate; - // The PaymentRequest object owning an instance of web::PaymentRequest as // provided by the page invoking the Payment Request API. This is a weak // pointer and should outlive this class. PaymentRequest* _paymentRequest; // The currently selected item. May be nil. - PaymentMethodItem* _selectedItem; + __weak PaymentMethodItem* _selectedItem; } // Called when the user presses the return button. @@ -64,6 +63,7 @@ @end @implementation PaymentMethodSelectionViewController +@synthesize delegate = _delegate; - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { DCHECK(paymentRequest); @@ -83,14 +83,6 @@ return self; } -- (id<PaymentMethodSelectionViewControllerDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate:(id<PaymentMethodSelectionViewControllerDelegate>)delegate { - _delegate.reset(delegate); -} - - (void)onReturn { [_delegate paymentMethodSelectionViewControllerDidReturn:self]; } @@ -105,8 +97,8 @@ [model addSectionWithIdentifier:SectionIdentifierPayment]; for (const auto& paymentMethod : _paymentRequest->credit_cards()) { - PaymentMethodItem* paymentMethodItem = [[[PaymentMethodItem alloc] - initWithType:ItemTypePaymentMethod] autorelease]; + PaymentMethodItem* paymentMethodItem = + [[PaymentMethodItem alloc] initWithType:ItemTypePaymentMethod]; paymentMethodItem.accessibilityTraits |= UIAccessibilityTraitButton; paymentMethodItem.methodID = base::SysUTF16ToNSString(paymentMethod->TypeAndLastFourDigits()); @@ -126,7 +118,7 @@ } PaymentsTextItem* addPaymentMethod = - [[[PaymentsTextItem alloc] initWithType:ItemTypeAddMethod] autorelease]; + [[PaymentsTextItem alloc] initWithType:ItemTypeAddMethod]; addPaymentMethod.text = l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_ADD_METHOD_BUTTON); addPaymentMethod.image = NativeImage(IDR_IOS_PAYMENTS_ADD);
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm index 9e099fa8..e61c810 100644 --- a/ios/chrome/browser/payments/payment_request.mm +++ b/ios/chrome/browser/payments/payment_request.mm
@@ -15,6 +15,10 @@ #include "ios/chrome/browser/application_context.h" #include "ios/web/public/payments/payment_request.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + PaymentRequest::PaymentRequest( std::unique_ptr<web::PaymentRequest> web_payment_request, autofill::PersonalDataManager* personal_data_manager)
diff --git a/ios/chrome/browser/payments/payment_request_coordinator.h b/ios/chrome/browser/payments/payment_request_coordinator.h index b2e1d9a0..bd316ffc 100644 --- a/ios/chrome/browser/payments/payment_request_coordinator.h +++ b/ios/chrome/browser/payments/payment_request_coordinator.h
@@ -73,7 +73,7 @@ // The favicon of the page invoking the PaymentRequest API. Should be set before // calling |start|. -@property(nonatomic, retain) UIImage* pageFavicon; +@property(nonatomic, strong) UIImage* pageFavicon; // The title of the page invoking the Payment Request API. Should be set before // calling |start|.
diff --git a/ios/chrome/browser/payments/payment_request_coordinator.mm b/ios/chrome/browser/payments/payment_request_coordinator.mm index 6205c4b..b6fde1d 100644 --- a/ios/chrome/browser/payments/payment_request_coordinator.mm +++ b/ios/chrome/browser/payments/payment_request_coordinator.mm
@@ -7,9 +7,6 @@ #include <unordered_set> #include <vector> -#import "base/ios/weak_nsobject.h" -#include "base/mac/objc_property_releaser.h" -#include "base/mac/scoped_nsobject.h" #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/strings/sys_string_conversions.h" @@ -28,6 +25,10 @@ #include "ios/chrome/browser/payments/payment_request_util.h" #include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + // The unmask prompt UI for Payment Request. class PRCardUnmaskPromptViewBridge : public autofill::CardUnmaskPromptViewBridge { @@ -36,7 +37,7 @@ autofill::CardUnmaskPromptController* controller, UIViewController* base_view_controller) : autofill::CardUnmaskPromptViewBridge(controller), - base_view_controller_(base_view_controller){}; + base_view_controller_(base_view_controller) {} // autofill::CardUnmaskPromptView: void Show() override { @@ -48,7 +49,7 @@ }; private: - UIViewController* base_view_controller_; // Weak. + __weak UIViewController* base_view_controller_; DISALLOW_COPY_AND_ASSIGN(PRCardUnmaskPromptViewBridge); }; @@ -108,36 +109,25 @@ } private: - PaymentRequestCoordinator* owner_; // Weak. Owns this instance. - UIViewController* base_view_controller_; // Weak. + __weak PaymentRequestCoordinator* owner_; + __weak UIViewController* base_view_controller_; autofill::CardUnmaskPromptControllerImpl unmask_controller_; DISALLOW_COPY_AND_ASSIGN(FullCardRequester); }; -@interface PaymentRequestCoordinator () { - base::WeakNSProtocol<id<PaymentRequestCoordinatorDelegate>> _delegate; - base::scoped_nsobject<UINavigationController> _navigationController; - base::scoped_nsobject<PaymentRequestViewController> _viewController; - base::scoped_nsobject<PaymentItemsDisplayCoordinator> - _itemsDisplayCoordinator; - base::scoped_nsobject<ShippingAddressSelectionCoordinator> - _shippingAddressSelectionCoordinator; - base::scoped_nsobject<ShippingOptionSelectionCoordinator> - _shippingOptionSelectionCoordinator; - base::scoped_nsobject<PaymentMethodSelectionCoordinator> - _methodSelectionCoordinator; +@implementation PaymentRequestCoordinator { + UINavigationController* _navigationController; + PaymentRequestViewController* _viewController; + PaymentItemsDisplayCoordinator* _itemsDisplayCoordinator; + ShippingAddressSelectionCoordinator* _shippingAddressSelectionCoordinator; + ShippingOptionSelectionCoordinator* _shippingOptionSelectionCoordinator; + PaymentMethodSelectionCoordinator* _methodSelectionCoordinator; // Receiver of the full credit card details. Also displays the unmask prompt // UI. std::unique_ptr<FullCardRequester> _fullCardRequester; - base::mac::ObjCPropertyReleaser _propertyReleaser_PaymentRequestCoordinator; -} - -@end - -@implementation PaymentRequestCoordinator { // The selected shipping address, pending approval from the page. autofill::AutofillProfile* _pendingShippingAddress; } @@ -148,35 +138,23 @@ @synthesize pageFavicon = _pageFavicon; @synthesize pageTitle = _pageTitle; @synthesize pageHost = _pageHost; +@synthesize delegate = _delegate; -- (instancetype)initWithBaseViewController: - (UIViewController*)baseViewController { - if ((self = [super initWithBaseViewController:baseViewController])) { - _propertyReleaser_PaymentRequestCoordinator.Init( - self, [PaymentRequestCoordinator class]); - } - return self; -} - -- (id<PaymentRequestCoordinatorDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate:(id<PaymentRequestCoordinatorDelegate>)delegate { - _delegate.reset(delegate); +- (instancetype)initWithBaseViewController:(UIViewController*)viewController { + return [super initWithBaseViewController:viewController]; } - (void)start { - _viewController.reset([[PaymentRequestViewController alloc] - initWithPaymentRequest:_paymentRequest]); + _viewController = [[PaymentRequestViewController alloc] + initWithPaymentRequest:_paymentRequest]; [_viewController setPageFavicon:_pageFavicon]; [_viewController setPageTitle:_pageTitle]; [_viewController setPageHost:_pageHost]; [_viewController setDelegate:self]; [_viewController loadModel]; - _navigationController.reset([[UINavigationController alloc] - initWithRootViewController:_viewController]); + _navigationController = [[UINavigationController alloc] + initWithRootViewController:_viewController]; [_navigationController setNavigationBarHidden:YES]; [[self baseViewController] presentViewController:_navigationController @@ -188,12 +166,12 @@ [[_navigationController presentingViewController] dismissViewControllerAnimated:YES completion:nil]; - _itemsDisplayCoordinator.reset(); - _shippingAddressSelectionCoordinator.reset(); - _shippingOptionSelectionCoordinator.reset(); - _methodSelectionCoordinator.reset(); - _navigationController.reset(); - _viewController.reset(); + _itemsDisplayCoordinator = nil; + _shippingAddressSelectionCoordinator = nil; + _shippingOptionSelectionCoordinator = nil; + _methodSelectionCoordinator = nil; + _navigationController = nil; + _viewController = nil; } - (void)sendPaymentResponse { @@ -260,7 +238,7 @@ // Dismiss the shipping address selection view. [_shippingAddressSelectionCoordinator stop]; - _shippingAddressSelectionCoordinator.reset(); + _shippingAddressSelectionCoordinator = nil; } else if (_shippingOptionSelectionCoordinator) { // Update the selected shipping option in the payment request summary // view. The updated selection is already reflected in |_paymentRequest|. @@ -268,7 +246,7 @@ // Dismiss the shipping option selection view. [_shippingOptionSelectionCoordinator stop]; - _shippingOptionSelectionCoordinator.reset(); + _shippingOptionSelectionCoordinator = nil; } } } @@ -287,8 +265,8 @@ - (void)paymentRequestViewControllerDidSelectPaymentSummaryItem: (PaymentRequestViewController*)controller { - _itemsDisplayCoordinator.reset([[PaymentItemsDisplayCoordinator alloc] - initWithBaseViewController:_viewController]); + _itemsDisplayCoordinator = [[PaymentItemsDisplayCoordinator alloc] + initWithBaseViewController:_viewController]; [_itemsDisplayCoordinator setPaymentRequest:_paymentRequest]; [_itemsDisplayCoordinator setDelegate:self]; @@ -297,9 +275,9 @@ - (void)paymentRequestViewControllerDidSelectShippingAddressItem: (PaymentRequestViewController*)controller { - _shippingAddressSelectionCoordinator.reset( + _shippingAddressSelectionCoordinator = [[ShippingAddressSelectionCoordinator alloc] - initWithBaseViewController:_viewController]); + initWithBaseViewController:_viewController]; [_shippingAddressSelectionCoordinator setPaymentRequest:_paymentRequest]; [_shippingAddressSelectionCoordinator setDelegate:self]; @@ -308,9 +286,9 @@ - (void)paymentRequestViewControllerDidSelectShippingOptionItem: (PaymentRequestViewController*)controller { - _shippingOptionSelectionCoordinator.reset( + _shippingOptionSelectionCoordinator = [[ShippingOptionSelectionCoordinator alloc] - initWithBaseViewController:_viewController]); + initWithBaseViewController:_viewController]; [_shippingOptionSelectionCoordinator setPaymentRequest:_paymentRequest]; [_shippingOptionSelectionCoordinator setDelegate:self]; @@ -319,8 +297,8 @@ - (void)paymentRequestViewControllerDidSelectPaymentMethodItem: (PaymentRequestViewController*)controller { - _methodSelectionCoordinator.reset([[PaymentMethodSelectionCoordinator alloc] - initWithBaseViewController:_viewController]); + _methodSelectionCoordinator = [[PaymentMethodSelectionCoordinator alloc] + initWithBaseViewController:_viewController]; [_methodSelectionCoordinator setPaymentRequest:_paymentRequest]; [_methodSelectionCoordinator setDelegate:self]; @@ -335,7 +313,7 @@ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; [_itemsDisplayCoordinator stop]; - _itemsDisplayCoordinator.reset(); + _itemsDisplayCoordinator = nil; } - (void)paymentItemsDisplayCoordinatorDidConfirm: @@ -362,7 +340,7 @@ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; [_shippingAddressSelectionCoordinator stop]; - _shippingAddressSelectionCoordinator.reset(); + _shippingAddressSelectionCoordinator = nil; } #pragma mark - ShippingOptionSelectionCoordinatorDelegate @@ -381,7 +359,7 @@ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; [_shippingOptionSelectionCoordinator stop]; - _shippingOptionSelectionCoordinator.reset(); + _shippingOptionSelectionCoordinator = nil; } #pragma mark - PaymentMethodSelectionCoordinatorDelegate @@ -397,7 +375,7 @@ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; [_methodSelectionCoordinator stop]; - _methodSelectionCoordinator.reset(); + _methodSelectionCoordinator = nil; } - (void)paymentMethodSelectionCoordinatorDidReturn: @@ -406,7 +384,7 @@ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; [_methodSelectionCoordinator stop]; - _methodSelectionCoordinator.reset(); + _methodSelectionCoordinator = nil; } @end
diff --git a/ios/chrome/browser/payments/payment_request_manager.mm b/ios/chrome/browser/payments/payment_request_manager.mm index f4cbdc0..5bab919 100644 --- a/ios/chrome/browser/payments/payment_request_manager.mm +++ b/ios/chrome/browser/payments/payment_request_manager.mm
@@ -5,10 +5,8 @@ #import "ios/chrome/browser/payments/payment_request_manager.h" #include "base/ios/ios_util.h" -#import "base/ios/weak_nsobject.h" #import "base/mac/bind_objc_block.h" #include "base/mac/foundation_util.h" -#include "base/mac/scoped_nsobject.h" #include "base/memory/ptr_util.h" #include "base/strings/sys_string_conversions.h" #import "base/values.h" @@ -32,6 +30,10 @@ #include "ios/web/public/web_state/web_state.h" #import "ios/web/public/web_state/web_state_observer_bridge.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // Command prefix for injected JavaScript. const std::string kCommandPrefix = "paymentRequest"; @@ -48,7 +50,7 @@ @interface PaymentRequestManager ()<CRWWebStateObserver, PaymentRequestCoordinatorDelegate> { // View controller used to present the PaymentRequest view controller. - base::WeakNSObject<UIViewController> _baseViewController; + __weak UIViewController* _baseViewController; // PersonalDataManager used to manage user credit cards and addresses. autofill::PersonalDataManager* _personalDataManager; @@ -66,7 +68,7 @@ std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; // Object that manages JavaScript injection into the web view. - base::WeakNSObject<JSPaymentRequestManager> _paymentRequestJsManager; + __weak JSPaymentRequestManager* _paymentRequestJsManager; // Boolean to track if the current WebState is enabled (JS callback is set // up). @@ -81,14 +83,14 @@ BOOL _closed; // Coordinator used to create and present the PaymentRequest view controller. - base::scoped_nsobject<PaymentRequestCoordinator> _paymentRequestCoordinator; + PaymentRequestCoordinator* _paymentRequestCoordinator; // Timer used to periodically unblock the webview's JS event queue. - base::scoped_nsobject<NSTimer> _unblockEventQueueTimer; + NSTimer* _unblockEventQueueTimer; // Timer used to close the UI if the page does not call // PaymentResponse.complete() in a timely fashion. - base::scoped_nsobject<NSTimer> _paymentResponseTimeoutTimer; + NSTimer* _paymentResponseTimeoutTimer; } // Synchronous method executed by -asynchronouslyEnablePaymentRequest: @@ -136,7 +138,7 @@ browserState: (ios::ChromeBrowserState*)browserState { if ((self = [super init])) { - _baseViewController.reset(viewController); + _baseViewController = viewController; _browserState = browserState; @@ -155,10 +157,10 @@ - (void)setWebState:(web::WebState*)webState { [self disconnectWebState]; if (webState) { - _paymentRequestJsManager.reset( + _paymentRequestJsManager = base::mac::ObjCCastStrict<JSPaymentRequestManager>( [webState->GetJSInjectionReceiver() - instanceOfClass:[JSPaymentRequestManager class]])); + instanceOfClass:[JSPaymentRequestManager class]]); _webState = webState; _webStateObserver.reset(new web::WebStateObserverBridge(webState, self)); [self enableCurrentWebState]; @@ -171,7 +173,7 @@ // Asynchronously enables PaymentRequest, so that some preferences // (UIAccessibilityIsVoiceOverRunning(), for example) have time to synchronize // with their own notifications. - base::WeakNSObject<PaymentRequestManager> weakSelf(self); + __weak PaymentRequestManager* weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf doEnablePaymentRequest:enabled]; }); @@ -215,14 +217,12 @@ if (_enabled) { if (!_webStateEnabled) { - base::WeakNSObject<PaymentRequestManager> weakSelf(self); - auto callback = - base::BindBlock(^bool(const base::DictionaryValue& JSON, - const GURL& originURL, bool userIsInteracting) { - base::scoped_nsobject<PaymentRequestManager> strongSelf( - [weakSelf retain]); + __weak PaymentRequestManager* weakSelf = self; + auto callback = base::BindBlockArc( + ^bool(const base::DictionaryValue& JSON, const GURL& originURL, + bool userIsInteracting) { // |originURL| and |userIsInteracting| aren't used. - return [strongSelf handleScriptCommand:JSON]; + return [weakSelf handleScriptCommand:JSON]; }); [self webState]->AddScriptCommandCallback(callback, kCommandPrefix); @@ -242,7 +242,7 @@ - (void)disconnectWebState { if (_webState) { - _paymentRequestJsManager.reset(); + _paymentRequestJsManager = nil; _webStateObserver.reset(); [self disableCurrentWebState]; } @@ -314,8 +314,8 @@ base::SysUTF8ToNSString([self webState]->GetLastCommittedURL().host()); autofill::AutofillManager* autofillManager = autofill::AutofillDriverIOS::FromWebState(_webState)->autofill_manager(); - _paymentRequestCoordinator.reset([[PaymentRequestCoordinator alloc] - initWithBaseViewController:_baseViewController]); + _paymentRequestCoordinator = [[PaymentRequestCoordinator alloc] + initWithBaseViewController:_baseViewController]; [_paymentRequestCoordinator setPaymentRequest:_paymentRequest.get()]; [_paymentRequestCoordinator setAutofillManager:autofillManager]; [_paymentRequestCoordinator setBrowserState:_browserState]; @@ -376,26 +376,26 @@ } - (void)setUnblockEventQueueTimer { - _unblockEventQueueTimer.reset( - [[NSTimer scheduledTimerWithTimeInterval:kNoopInterval - target:_paymentRequestJsManager - selector:@selector(executeNoop) - userInfo:nil - repeats:YES] retain]); + _unblockEventQueueTimer = + [NSTimer scheduledTimerWithTimeInterval:kNoopInterval + target:_paymentRequestJsManager + selector:@selector(executeNoop) + userInfo:nil + repeats:YES]; } - (void)setPaymentResponseTimeoutTimer { - _paymentResponseTimeoutTimer.reset( - [[NSTimer scheduledTimerWithTimeInterval:kTimeoutInterval - target:self - selector:@selector(handleResponseComplete) - userInfo:nil - repeats:NO] retain]); + _paymentResponseTimeoutTimer = + [NSTimer scheduledTimerWithTimeInterval:kTimeoutInterval + target:self + selector:@selector(handleResponseComplete) + userInfo:nil + repeats:NO]; } - (void)dismissUI { [_paymentRequestCoordinator stop]; - _paymentRequestCoordinator.reset(); + _paymentRequestCoordinator = nil; } - (BOOL)webStateContentIsSecureHTML {
diff --git a/ios/chrome/browser/payments/payment_request_util.mm b/ios/chrome/browser/payments/payment_request_util.mm index 5bdf315..12dbde21 100644 --- a/ios/chrome/browser/payments/payment_request_util.mm +++ b/ios/chrome/browser/payments/payment_request_util.mm
@@ -13,6 +13,10 @@ #include "ios/chrome/browser/payments/payment_request.h" #include "ui/base/l10n/l10n_util.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace payment_request_util { NSString* NameLabelFromAutofillProfile(autofill::AutofillProfile* profile) {
diff --git a/ios/chrome/browser/payments/payment_request_view_controller.h b/ios/chrome/browser/payments/payment_request_view_controller.h index d0f9e5631..f28ab1f 100644 --- a/ios/chrome/browser/payments/payment_request_view_controller.h +++ b/ios/chrome/browser/payments/payment_request_view_controller.h
@@ -49,7 +49,7 @@ @interface PaymentRequestViewController : CollectionViewController // The favicon of the page invoking the Payment Request API. -@property(nonatomic, retain) UIImage* pageFavicon; +@property(nonatomic, strong) UIImage* pageFavicon; // The title of the page invoking the Payment Request API. @property(nonatomic, copy) NSString* pageTitle;
diff --git a/ios/chrome/browser/payments/payment_request_view_controller.mm b/ios/chrome/browser/payments/payment_request_view_controller.mm index 8d9f78a..0e2ce21 100644 --- a/ios/chrome/browser/payments/payment_request_view_controller.mm +++ b/ios/chrome/browser/payments/payment_request_view_controller.mm
@@ -4,10 +4,8 @@ #import "ios/chrome/browser/payments/payment_request_view_controller.h" -#import "base/ios/weak_nsobject.h" #include "base/mac/foundation_util.h" -#include "base/mac/objc_property_releaser.h" -#include "base/mac/scoped_nsobject.h" + #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/autofill_data_util.h" @@ -38,6 +36,10 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + using payment_request_util::NameLabelFromAutofillProfile; using payment_request_util::AddressLabelFromAutofillProfile; using payment_request_util::PhoneNumberLabelFromAutofillProfile; @@ -73,9 +75,8 @@ } // namespace @interface PaymentRequestViewController () { - base::WeakNSProtocol<id<PaymentRequestViewControllerDelegate>> _delegate; - base::scoped_nsobject<UIBarButtonItem> _cancelButton; - base::scoped_nsobject<MDCFlatButton> _payButton; + UIBarButtonItem* _cancelButton; + MDCFlatButton* _payButton; // The PaymentRequest object owning an instance of web::PaymentRequest as // provided by the page invoking the Payment Request API. This is a weak @@ -86,9 +87,6 @@ ShippingAddressItem* _selectedShippingAddressItem; CollectionViewTextItem* _selectedShippingOptionItem; PaymentMethodItem* _selectedPaymentMethodItem; - - base::mac::ObjCPropertyReleaser - _propertyReleaser_PaymentRequestViewController; } // Called when the user presses the cancel button. @@ -104,22 +102,20 @@ @synthesize pageFavicon = _pageFavicon; @synthesize pageTitle = _pageTitle; @synthesize pageHost = _pageHost; +@synthesize delegate = _delegate; - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { DCHECK(paymentRequest); if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) { - _propertyReleaser_PaymentRequestViewController.Init( - self, [PaymentRequestViewController class]); - [self setTitle:l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_TITLE)]; // Set up left (cancel) button. - _cancelButton.reset([[UIBarButtonItem alloc] + _cancelButton = [[UIBarButtonItem alloc] initWithTitle:l10n_util::GetNSString( IDS_IOS_PAYMENT_REQUEST_CANCEL_BUTTON) style:UIBarButtonItemStylePlain target:nil - action:@selector(onCancel)]); + action:@selector(onCancel)]; [_cancelButton setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor lightGrayColor] } @@ -129,7 +125,7 @@ [self navigationItem].leftBarButtonItem = _cancelButton; // Set up right (pay) button. - _payButton.reset([[MDCFlatButton alloc] init]); + _payButton = [[MDCFlatButton alloc] init]; [_payButton setTitle:l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_PAY_BUTTON) forState:UIControlStateNormal]; @@ -151,8 +147,7 @@ // height of the bar. We don't want that for the button so we use a UIView // here to contain the button instead and the button is vertically centered // inside the full bar height. - UIView* buttonView = - [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; + UIView* buttonView = [[UIView alloc] initWithFrame:CGRectZero]; [buttonView addSubview:_payButton]; // Navigation bar button items are aligned with the trailing edge of the // screen. Make the enclosing view larger here. The pay button will be @@ -164,7 +159,7 @@ buttonView.bounds = buttonViewBounds; UIBarButtonItem* payButtonItem = - [[[UIBarButtonItem alloc] initWithCustomView:buttonView] autorelease]; + [[UIBarButtonItem alloc] initWithCustomView:buttonView]; [self navigationItem].rightBarButtonItem = payButtonItem; _paymentRequest = paymentRequest; @@ -172,14 +167,6 @@ return self; } -- (id<PaymentRequestViewControllerDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate:(id<PaymentRequestViewControllerDelegate>)delegate { - _delegate.reset(delegate); -} - - (void)onCancel { [_delegate paymentRequestViewControllerDidCancel:self]; } @@ -198,14 +185,13 @@ [model addSectionWithIdentifier:SectionIdentifierSummary]; PageInfoItem* pageInfo = - [[[PageInfoItem alloc] initWithType:ItemTypeSummaryPageInfo] autorelease]; + [[PageInfoItem alloc] initWithType:ItemTypeSummaryPageInfo]; pageInfo.pageFavicon = _pageFavicon; pageInfo.pageTitle = _pageTitle; pageInfo.pageHost = _pageHost; [model setHeader:pageInfo forSectionWithIdentifier:SectionIdentifierSummary]; - _paymentSummaryItem = - [[[PriceItem alloc] initWithType:ItemTypeSummaryTotal] autorelease]; + _paymentSummaryItem = [[PriceItem alloc] initWithType:ItemTypeSummaryTotal]; [self fillPaymentSummaryItem:_paymentSummaryItem withPaymentItem:_paymentRequest->payment_details().total withTotalValueChanged:NO]; @@ -220,8 +206,8 @@ // Shipping section. [model addSectionWithIdentifier:SectionIdentifierShipping]; - CollectionViewTextItem* shippingTitle = [[[CollectionViewTextItem alloc] - initWithType:ItemTypeShippingTitle] autorelease]; + CollectionViewTextItem* shippingTitle = + [[CollectionViewTextItem alloc] initWithType:ItemTypeShippingTitle]; shippingTitle.text = payment_request_util::GetShippingSectionTitle(_paymentRequest); [model setHeader:shippingTitle @@ -229,8 +215,8 @@ CollectionViewItem* shippingAddressItem = nil; if (_paymentRequest->selected_shipping_profile()) { - _selectedShippingAddressItem = [[[ShippingAddressItem alloc] - initWithType:ItemTypeShippingAddress] autorelease]; + _selectedShippingAddressItem = + [[ShippingAddressItem alloc] initWithType:ItemTypeShippingAddress]; shippingAddressItem = _selectedShippingAddressItem; [self fillShippingAddressItem:_selectedShippingAddressItem withAddress:_paymentRequest->selected_shipping_profile()]; @@ -238,9 +224,8 @@ MDCCollectionViewCellAccessoryDisclosureIndicator; } else { - CollectionViewDetailItem* addAddressItem = - [[[CollectionViewDetailItem alloc] - initWithType:ItemTypeAddShippingAddress] autorelease]; + CollectionViewDetailItem* addAddressItem = [[CollectionViewDetailItem alloc] + initWithType:ItemTypeAddShippingAddress]; shippingAddressItem = addAddressItem; addAddressItem.text = payment_request_util::GetShippingAddressSelectorTitle(_paymentRequest); @@ -254,8 +239,8 @@ CollectionViewItem* shippingOptionItem = nil; if (_paymentRequest->selected_shipping_option()) { - _selectedShippingOptionItem = [[[CollectionViewTextItem alloc] - initWithType:ItemTypeShippingOption] autorelease]; + _selectedShippingOptionItem = + [[CollectionViewTextItem alloc] initWithType:ItemTypeShippingOption]; shippingOptionItem = _selectedShippingOptionItem; [self fillShippingOptionItem:_selectedShippingOptionItem withOption:_paymentRequest->selected_shipping_option()]; @@ -263,8 +248,8 @@ MDCCollectionViewCellAccessoryDisclosureIndicator; } else { CollectionViewDetailItem* selectShippingOptionItem = - [[[CollectionViewDetailItem alloc] - initWithType:ItemTypeSelectShippingOption] autorelease]; + [[CollectionViewDetailItem alloc] + initWithType:ItemTypeSelectShippingOption]; shippingOptionItem = selectShippingOptionItem; selectShippingOptionItem.text = payment_request_util::GetShippingOptionSelectorTitle(_paymentRequest); @@ -280,24 +265,23 @@ CollectionViewItem* paymentMethodItem = nil; if (_paymentRequest->selected_credit_card()) { - CollectionViewTextItem* paymentTitle = [[[CollectionViewTextItem alloc] - initWithType:ItemTypePaymentTitle] autorelease]; + CollectionViewTextItem* paymentTitle = + [[CollectionViewTextItem alloc] initWithType:ItemTypePaymentTitle]; paymentTitle.text = l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_PAYMENT_METHOD_HEADER); [model setHeader:paymentTitle forSectionWithIdentifier:SectionIdentifierPayment]; - _selectedPaymentMethodItem = [[[PaymentMethodItem alloc] - initWithType:ItemTypePaymentMethod] autorelease]; + _selectedPaymentMethodItem = + [[PaymentMethodItem alloc] initWithType:ItemTypePaymentMethod]; paymentMethodItem = _selectedPaymentMethodItem; [self fillPaymentMethodItem:_selectedPaymentMethodItem withPaymentMethod:_paymentRequest->selected_credit_card()]; _selectedPaymentMethodItem.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; } else { - CollectionViewDetailItem* addPaymentMethodItem = - [[[CollectionViewDetailItem alloc] - initWithType:ItemTypeAddPaymentMethod] autorelease]; + CollectionViewDetailItem* addPaymentMethodItem = [ + [CollectionViewDetailItem alloc] initWithType:ItemTypeAddPaymentMethod]; paymentMethodItem = addPaymentMethodItem; addPaymentMethodItem.text = l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_PAYMENT_METHOD_HEADER);
diff --git a/ios/chrome/browser/payments/shipping_address_selection_coordinator.mm b/ios/chrome/browser/payments/shipping_address_selection_coordinator.mm index e3dfcb5..57c2efd 100644 --- a/ios/chrome/browser/payments/shipping_address_selection_coordinator.mm +++ b/ios/chrome/browser/payments/shipping_address_selection_coordinator.mm
@@ -4,18 +4,19 @@ #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" -#import "base/ios/weak_nsobject.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "components/autofill/core/browser/autofill_profile.h" #include "ios/chrome/browser/payments/payment_request.h" #import "ios/chrome/browser/payments/payment_request_util.h" -@interface ShippingAddressSelectionCoordinator () { - base::WeakNSProtocol<id<ShippingAddressSelectionCoordinatorDelegate>> - _delegate; - base::scoped_nsobject<ShippingAddressSelectionViewController> _viewController; -} +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface ShippingAddressSelectionCoordinator () + +@property(nonatomic, strong) + ShippingAddressSelectionViewController* viewController; // Called when the user selects a shipping address. The cell is checked, the // UI is locked so that the user can't interact with it, then the delegate is @@ -29,18 +30,12 @@ @implementation ShippingAddressSelectionCoordinator @synthesize paymentRequest = _paymentRequest; - -- (id<ShippingAddressSelectionCoordinatorDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate:(id<ShippingAddressSelectionCoordinatorDelegate>)delegate { - _delegate.reset(delegate); -} +@synthesize delegate = _delegate; +@synthesize viewController = _viewController; - (void)start { - _viewController.reset([[ShippingAddressSelectionViewController alloc] - initWithPaymentRequest:_paymentRequest]); + _viewController = [[ShippingAddressSelectionViewController alloc] + initWithPaymentRequest:_paymentRequest]; [_viewController setDelegate:self]; [_viewController loadModel]; @@ -52,13 +47,13 @@ - (void)stop { [self.baseViewController.navigationController popViewControllerAnimated:YES]; - _viewController.reset(); + _viewController = nil; } - (void)stopSpinnerAndDisplayError { // Re-enable user interactions that were disabled earlier in // delayedNotifyDelegateOfSelection. - _viewController.get().view.userInteractionEnabled = YES; + _viewController.view.userInteractionEnabled = YES; [_viewController setIsLoading:NO]; NSString* errorMessage = @@ -85,25 +80,20 @@ - (void)delayedNotifyDelegateOfSelection: (autofill::AutofillProfile*)shippingAddress { - _viewController.get().view.userInteractionEnabled = NO; - base::WeakNSObject<ShippingAddressSelectionCoordinator> weakSelf(self); - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, - static_cast<int64_t>(0.2 * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - base::scoped_nsobject<ShippingAddressSelectionCoordinator> strongSelf( - [weakSelf retain]); - // Early return if the coordinator has been deallocated. - if (!strongSelf) - return; + _viewController.view.userInteractionEnabled = NO; + __weak ShippingAddressSelectionCoordinator* weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, + static_cast<int64_t>(0.2 * NSEC_PER_SEC)), + dispatch_get_main_queue(), ^{ + ShippingAddressSelectionCoordinator* strongSelf = weakSelf; + [strongSelf.viewController setIsLoading:YES]; + [strongSelf.viewController loadModel]; + [[strongSelf.viewController collectionView] reloadData]; - [_viewController setIsLoading:YES]; - [_viewController loadModel]; - [[_viewController collectionView] reloadData]; - - [_delegate shippingAddressSelectionCoordinator:self - didSelectShippingAddress:shippingAddress]; - }); + [strongSelf.delegate + shippingAddressSelectionCoordinator:strongSelf + didSelectShippingAddress:shippingAddress]; + }); } @end
diff --git a/ios/chrome/browser/payments/shipping_address_selection_view_controller.h b/ios/chrome/browser/payments/shipping_address_selection_view_controller.h index 5bc73bb..113bb734 100644 --- a/ios/chrome/browser/payments/shipping_address_selection_view_controller.h +++ b/ios/chrome/browser/payments/shipping_address_selection_view_controller.h
@@ -42,7 +42,7 @@ @property(nonatomic, assign) BOOL isLoading; // The error message to display, if any. -@property(nonatomic, assign) NSString* errorMessage; +@property(nonatomic, copy) NSString* errorMessage; // The delegate to be notified when the user selects a shipping address or // returns without selecting one.
diff --git a/ios/chrome/browser/payments/shipping_address_selection_view_controller.mm b/ios/chrome/browser/payments/shipping_address_selection_view_controller.mm index 19a7041..8640d1d4 100644 --- a/ios/chrome/browser/payments/shipping_address_selection_view_controller.mm +++ b/ios/chrome/browser/payments/shipping_address_selection_view_controller.mm
@@ -4,7 +4,6 @@ #import "ios/chrome/browser/payments/shipping_address_selection_view_controller.h" -#import "base/ios/weak_nsobject.h" #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "components/autofill/core/browser/autofill_profile.h" @@ -25,6 +24,10 @@ #include "ios/chrome/grit/ios_theme_resources.h" #include "ui/base/l10n/l10n_util.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + using payment_request_util::NameLabelFromAutofillProfile; using payment_request_util::AddressLabelFromAutofillProfile; using payment_request_util::PhoneNumberLabelFromAutofillProfile; @@ -50,16 +53,13 @@ } // namespace @interface ShippingAddressSelectionViewController () { - base::WeakNSProtocol<id<ShippingAddressSelectionViewControllerDelegate>> - _delegate; - // The PaymentRequest object owning an instance of web::PaymentRequest as // provided by the page invoking the Payment Request API. This is a weak // pointer and should outlive this class. PaymentRequest* _paymentRequest; // The currently selected item. May be nil. - ShippingAddressItem* _selectedItem; + __weak ShippingAddressItem* _selectedItem; } // Called when the user presses the return button. @@ -71,6 +71,7 @@ @synthesize isLoading = _isLoading; @synthesize errorMessage = _errorMessage; +@synthesize delegate = _delegate; - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { DCHECK(paymentRequest); @@ -90,15 +91,6 @@ return self; } -- (id<ShippingAddressSelectionViewControllerDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate: - (id<ShippingAddressSelectionViewControllerDelegate>)delegate { - _delegate.reset(delegate); -} - - (void)onReturn { [_delegate shippingAddressSelectionViewControllerDidReturn:self]; } @@ -113,8 +105,7 @@ [model addSectionWithIdentifier:SectionIdentifierShippingAddress]; if (_isLoading) { - StatusItem* statusItem = - [[[StatusItem alloc] initWithType:ItemTypeSpinner] autorelease]; + StatusItem* statusItem = [[StatusItem alloc] initWithType:ItemTypeSpinner]; statusItem.text = l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_CHECKING_LABEL); [model addItem:statusItem @@ -123,7 +114,7 @@ } PaymentsTextItem* messageItem = - [[[PaymentsTextItem alloc] initWithType:ItemTypeMessage] autorelease]; + [[PaymentsTextItem alloc] initWithType:ItemTypeMessage]; if (_errorMessage) { messageItem.text = _errorMessage; messageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); @@ -136,8 +127,8 @@ toSectionWithIdentifier:SectionIdentifierShippingAddress]; for (const auto& shippingAddress : _paymentRequest->shipping_profiles()) { - ShippingAddressItem* item = [[[ShippingAddressItem alloc] - initWithType:ItemTypeShippingAddress] autorelease]; + ShippingAddressItem* item = + [[ShippingAddressItem alloc] initWithType:ItemTypeShippingAddress]; item.accessibilityTraits |= UIAccessibilityTraitButton; item.name = NameLabelFromAutofillProfile(shippingAddress); item.address = AddressLabelFromAutofillProfile(shippingAddress); @@ -150,8 +141,8 @@ toSectionWithIdentifier:SectionIdentifierShippingAddress]; } - PaymentsTextItem* addShippingAddress = [[[PaymentsTextItem alloc] - initWithType:ItemTypeAddShippingAddress] autorelease]; + PaymentsTextItem* addShippingAddress = + [[PaymentsTextItem alloc] initWithType:ItemTypeAddShippingAddress]; addShippingAddress.text = l10n_util::GetNSString( IDS_IOS_PAYMENT_REQUEST_SHIPPING_ADDRESS_SELECTION_ADD_BUTTON); addShippingAddress.image = NativeImage(IDR_IOS_PAYMENTS_ADD);
diff --git a/ios/chrome/browser/payments/shipping_option_selection_coordinator.mm b/ios/chrome/browser/payments/shipping_option_selection_coordinator.mm index c30c6bed..8d37c51 100644 --- a/ios/chrome/browser/payments/shipping_option_selection_coordinator.mm +++ b/ios/chrome/browser/payments/shipping_option_selection_coordinator.mm
@@ -4,16 +4,17 @@ #import "ios/chrome/browser/payments/shipping_option_selection_coordinator.h" -#import "base/ios/weak_nsobject.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #import "ios/chrome/browser/payments/payment_request_util.h" -@interface ShippingOptionSelectionCoordinator () { - base::WeakNSProtocol<id<ShippingOptionSelectionCoordinatorDelegate>> - _delegate; - base::scoped_nsobject<ShippingOptionSelectionViewController> _viewController; -} +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface ShippingOptionSelectionCoordinator () + +@property(nonatomic, strong) + ShippingOptionSelectionViewController* viewController; // Called when the user selects a shipping option. The cell is checked, the // UI is locked so that the user can't interact with it, then the delegate is @@ -27,18 +28,12 @@ @implementation ShippingOptionSelectionCoordinator @synthesize paymentRequest = _paymentRequest; - -- (id<ShippingOptionSelectionCoordinatorDelegate>)delegate { - return _delegate.get(); -} - -- (void)setDelegate:(id<ShippingOptionSelectionCoordinatorDelegate>)delegate { - _delegate.reset(delegate); -} +@synthesize delegate = _delegate; +@synthesize viewController = _viewController; - (void)start { - _viewController.reset([[ShippingOptionSelectionViewController alloc] - initWithPaymentRequest:_paymentRequest]); + _viewController = [[ShippingOptionSelectionViewController alloc] + initWithPaymentRequest:_paymentRequest]; [_viewController setDelegate:self]; [_viewController loadModel]; @@ -50,13 +45,13 @@ - (void)stop { [self.baseViewController.navigationController popViewControllerAnimated:YES]; - _viewController.reset(); + _viewController = nil; } - (void)stopSpinnerAndDisplayError { // Re-enable user interactions that were disabled earlier in // delayedNotifyDelegateOfSelection. - _viewController.get().view.userInteractionEnabled = YES; + _viewController.view.userInteractionEnabled = YES; [_viewController setIsLoading:NO]; NSString* errorMessage = @@ -83,24 +78,20 @@ - (void)delayedNotifyDelegateOfSelection: (web::PaymentShippingOption*)shippingOption { - _viewController.get().view.userInteractionEnabled = NO; - base::WeakNSObject<ShippingOptionSelectionCoordinator> weakSelf(self); - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, - static_cast<int64_t>(0.2 * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - base::scoped_nsobject<ShippingOptionSelectionCoordinator> strongSelf( - [weakSelf retain]); - // Early return if the coordinator has been deallocated. - if (!strongSelf) - return; - [_viewController setIsLoading:YES]; - [_viewController loadModel]; - [[_viewController collectionView] reloadData]; + _viewController.view.userInteractionEnabled = NO; + __weak ShippingOptionSelectionCoordinator* weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, + static_cast<int64_t>(0.2 * NSEC_PER_SEC)), + dispatch_get_main_queue(), ^{ + ShippingOptionSelectionCoordinator* strongSelf = weakSelf; + [strongSelf.viewController setIsLoading:YES]; + [strongSelf.viewController loadModel]; + [[strongSelf.viewController collectionView] reloadData]; - [_delegate shippingOptionSelectionCoordinator:self - didSelectShippingOption:shippingOption]; - }); + [strongSelf.delegate + shippingOptionSelectionCoordinator:strongSelf + didSelectShippingOption:shippingOption]; + }); } @end
diff --git a/ios/chrome/browser/payments/shipping_option_selection_view_controller.h b/ios/chrome/browser/payments/shipping_option_selection_view_controller.h index e1a4648d..fcf87c1 100644 --- a/ios/chrome/browser/payments/shipping_option_selection_view_controller.h +++ b/ios/chrome/browser/payments/shipping_option_selection_view_controller.h
@@ -38,7 +38,7 @@ @property(nonatomic, assign) BOOL isLoading; // The error message to display, if any. -@property(nonatomic, assign) NSString* errorMessage; +@property(nonatomic, copy) NSString* errorMessage; // The delegate to be notified when the user selects a shipping option or // returns without selecting one.
diff --git a/ios/chrome/browser/payments/shipping_option_selection_view_controller.mm b/ios/chrome/browser/payments/shipping_option_selection_view_controller.mm index 1620902..2903e44b 100644 --- a/ios/chrome/browser/payments/shipping_option_selection_view_controller.mm +++ b/ios/chrome/browser/payments/shipping_option_selection_view_controller.mm
@@ -4,7 +4,6 @@ #import "ios/chrome/browser/payments/shipping_option_selection_view_controller.h" -#import "base/ios/weak_nsobject.h" #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -26,6 +25,10 @@ #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" #include "ui/base/l10n/l10n_util.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + NSString* const kShippingOptionSelectionCollectionViewId = @"kShippingOptionSelectionCollectionViewId"; @@ -46,8 +49,7 @@ } // namespace @interface ShippingOptionSelectionViewController () { - base::WeakNSProtocol<id<ShippingOptionSelectionViewControllerDelegate>> - _delegate; + __weak id<ShippingOptionSelectionViewControllerDelegate> _delegate; // The PaymentRequest object owning an instance of web::PaymentRequest as // provided by the page invoking the Payment Request API. This is a weak @@ -87,12 +89,12 @@ } - (id<ShippingOptionSelectionViewControllerDelegate>)delegate { - return _delegate.get(); + return _delegate; } - (void)setDelegate: (id<ShippingOptionSelectionViewControllerDelegate>)delegate { - _delegate.reset(delegate); + _delegate = delegate; } - (void)onReturn { @@ -109,8 +111,7 @@ [model addSectionWithIdentifier:SectionIdentifierShippingOption]; if (self.isLoading) { - StatusItem* statusItem = - [[[StatusItem alloc] initWithType:ItemTypeSpinner] autorelease]; + StatusItem* statusItem = [[StatusItem alloc] initWithType:ItemTypeSpinner]; statusItem.text = l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_CHECKING_LABEL); [model addItem:statusItem @@ -120,7 +121,7 @@ if (_errorMessage) { PaymentsTextItem* messageItem = - [[[PaymentsTextItem alloc] initWithType:ItemTypeMessage] autorelease]; + [[PaymentsTextItem alloc] initWithType:ItemTypeMessage]; messageItem.text = _errorMessage; messageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); [model addItem:messageItem @@ -128,8 +129,8 @@ } for (const auto& shippingOption : _paymentRequest->shipping_options()) { - CollectionViewTextItem* item = [[[CollectionViewTextItem alloc] - initWithType:ItemTypeShippingOption] autorelease]; + CollectionViewTextItem* item = + [[CollectionViewTextItem alloc] initWithType:ItemTypeShippingOption]; item.text = base::SysUTF16ToNSString(shippingOption->label); payments::CurrencyFormatter* currencyFormatter = _paymentRequest->GetOrCreateCurrencyFormatter();
diff --git a/ios/chrome/browser/ui/tools_menu/BUILD.gn b/ios/chrome/browser/ui/tools_menu/BUILD.gn index 91972e30..9dcda12 100644 --- a/ios/chrome/browser/ui/tools_menu/BUILD.gn +++ b/ios/chrome/browser/ui/tools_menu/BUILD.gn
@@ -8,6 +8,8 @@ "reading_list_menu_view_item.mm", "tools_menu_context.h", "tools_menu_context.mm", + "tools_menu_model.h", + "tools_menu_model.mm", "tools_menu_view_controller.h", "tools_menu_view_controller.mm", "tools_menu_view_item.h",
diff --git a/ios/chrome/browser/ui/tools_menu/tools_menu_model.h b/ios/chrome/browser/ui/tools_menu/tools_menu_model.h new file mode 100644 index 0000000..2965b491 --- /dev/null +++ b/ios/chrome/browser/ui/tools_menu/tools_menu_model.h
@@ -0,0 +1,83 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_MODEL_H_ +#define IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_MODEL_H_ + +#import <Foundation/Foundation.h> + +// New Tab item accessibility Identifier. +extern NSString* const kToolsMenuNewTabId; +// New incognito Tab item accessibility Identifier. +extern NSString* const kToolsMenuNewIncognitoTabId; +// Close all Tabs item accessibility Identifier. +extern NSString* const kToolsMenuCloseAllTabsId; +// Close all incognito Tabs item accessibility Identifier. +extern NSString* const kToolsMenuCloseAllIncognitoTabsId; +// Bookmarks item accessibility Identifier. +extern NSString* const kToolsMenuBookmarksId; +// Reading List item accessibility Identifier. +extern NSString* const kToolsMenuReadingListId; +// Other Devices item accessibility Identifier. +extern NSString* const kToolsMenuOtherDevicesId; +// History item accessibility Identifier. +extern NSString* const kToolsMenuHistoryId; +// Report an issue item accessibility Identifier. +extern NSString* const kToolsMenuReportAnIssueId; +// Find in Page item accessibility Identifier. +extern NSString* const kToolsMenuFindInPageId; +// Reader Mode item accessibility Identifier. +extern NSString* const kToolsMenuReaderMode; +// Request desktop item accessibility Identifier. +extern NSString* const kToolsMenuRequestDesktopId; +// Settings item accessibility Identifier. +extern NSString* const kToolsMenuSettingsId; +// Help item accessibility Identifier. +extern NSString* const kToolsMenuHelpId; +// Suggestions item accessibility Identifier. +extern NSString* const kToolsMenuSuggestionsId; + +// Total number of possible menu items. +const int kToolsMenuNumberOfItems = 15; + +// Initialization table for all possible commands to initialize the +// tools menu at run time. Data initialized into this structure is not mutable. +struct MenuItemInfo { + int title_id; + NSString* accessibility_id; + int command_id; + int toolbar_types; + // |visibility| is applied if a menu item is included for a given + // |toolbar_types|. A value of 0 means the menu item is always visible for + // the given |toolbar_types|. + int visibility; + // Custom class, if any, for the menu item, or |nil|. + Class item_class; +}; + +// Flags for different toolbar types +typedef NS_OPTIONS(NSUInteger, ToolbarType) { + // clang-format off + ToolbarTypeNone = 0, + ToolbarTypeWebiPhone = 1 << 0, + ToolbarTypeWebiPad = 1 << 1, + ToolbarTypeNoTabsiPad = 1 << 2, + ToolbarTypeSwitcheriPhone = 1 << 3, + ToolbarTypeWebAll = ToolbarTypeWebiPhone | ToolbarTypeWebiPad, + ToolbarTypeAll = ToolbarTypeWebAll | + ToolbarTypeSwitcheriPhone | + ToolbarTypeNoTabsiPad, + // clang-format on +}; + +// All possible items. +extern const MenuItemInfo itemInfoList[kToolsMenuNumberOfItems]; + +// Returns true if a given item should be visible based on the Toolbar type +// and if incognito mode or not. +bool ToolsMenuItemShouldBeVisible(const MenuItemInfo& item, + bool incognito, + ToolbarType toolbarType); + +#endif // IOS_CHROME_BROWSER_UI_TOOLS_MENU_TOOLS_MENU_MODEL_H_
diff --git a/ios/chrome/browser/ui/tools_menu/tools_menu_model.mm b/ios/chrome/browser/ui/tools_menu/tools_menu_model.mm new file mode 100644 index 0000000..5387390 --- /dev/null +++ b/ios/chrome/browser/ui/tools_menu/tools_menu_model.mm
@@ -0,0 +1,102 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ios/chrome/browser/ui/tools_menu/tools_menu_model.h" + +#include "components/reading_list/core/reading_list_switches.h" +#include "components/strings/grit/components_strings.h" +#include "ios/chrome/browser/experimental_flags.h" +#include "ios/chrome/browser/ui/commands/ios_command_ids.h" +#import "ios/chrome/browser/ui/tools_menu/reading_list_menu_view_item.h" +#include "ios/chrome/browser/ui/ui_util.h" +#include "ios/chrome/grit/ios_strings.h" +#include "ios/public/provider/chrome/browser/chrome_browser_provider.h" +#import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider.h" + +// Menu items can be marked as visible or not when Incognito is enabled. +// The following bits are used for |visibility| field in |MenuItemInfo|. +const NSInteger kVisibleIncognitoOnly = 1 << 0; +const NSInteger kVisibleNotIncognitoOnly = 1 << 1; + +// Declare all the possible items. +const MenuItemInfo itemInfoList[] = { + // clang-format off + { IDS_IOS_TOOLS_MENU_NEW_TAB, kToolsMenuNewTabId, + IDC_NEW_TAB, ToolbarTypeAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_TAB, kToolsMenuNewIncognitoTabId, + IDC_NEW_INCOGNITO_TAB, ToolbarTypeAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_CLOSE_ALL_TABS, kToolsMenuCloseAllTabsId, + IDC_CLOSE_ALL_TABS, ToolbarTypeSwitcheriPhone, + kVisibleNotIncognitoOnly, nil }, + { IDS_IOS_TOOLS_MENU_CLOSE_ALL_INCOGNITO_TABS, + kToolsMenuCloseAllIncognitoTabsId, + IDC_CLOSE_ALL_INCOGNITO_TABS, ToolbarTypeSwitcheriPhone, + kVisibleIncognitoOnly, nil }, + { IDS_IOS_TOOLS_MENU_BOOKMARKS, kToolsMenuBookmarksId, + IDC_SHOW_BOOKMARK_MANAGER, ToolbarTypeWebAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_READING_LIST, kToolsMenuReadingListId, + IDC_SHOW_READING_LIST, ToolbarTypeWebAll, + 0, [ReadingListMenuViewItem class] }, + { IDS_IOS_TOOLS_MENU_SUGGESTIONS, kToolsMenuSuggestionsId, + IDC_SHOW_SUGGESTIONS, ToolbarTypeWebAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_RECENT_TABS, kToolsMenuOtherDevicesId, + IDC_SHOW_OTHER_DEVICES, ToolbarTypeWebAll, + kVisibleNotIncognitoOnly, nil }, + { IDS_HISTORY_SHOW_HISTORY, kToolsMenuHistoryId, + IDC_SHOW_HISTORY, ToolbarTypeWebAll, + 0, nil }, + { IDS_IOS_OPTIONS_REPORT_AN_ISSUE, kToolsMenuReportAnIssueId, + IDC_REPORT_AN_ISSUE, ToolbarTypeAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, kToolsMenuFindInPageId, + IDC_FIND, ToolbarTypeWebAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_REQUEST_DESKTOP_SITE, kToolsMenuRequestDesktopId, + IDC_REQUEST_DESKTOP_SITE, ToolbarTypeWebAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_READER_MODE, kToolsMenuReaderMode, + IDC_READER_MODE, ToolbarTypeWebAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_SETTINGS, kToolsMenuSettingsId, + IDC_OPTIONS, ToolbarTypeAll, + 0, nil }, + { IDS_IOS_TOOLS_MENU_HELP_MOBILE, kToolsMenuHelpId, + IDC_HELP_PAGE_VIA_MENU, ToolbarTypeWebAll, + 0, nil }, + // clang-format on +}; + +bool ToolsMenuItemShouldBeVisible(const MenuItemInfo& item, + bool incognito, + ToolbarType toolbarType) { + if (!(item.toolbar_types & toolbarType)) + return false; + + if (incognito && (item.visibility & kVisibleNotIncognitoOnly)) + return false; + + if (!incognito && (item.visibility & kVisibleIncognitoOnly)) + return false; + + switch (item.title_id) { + case IDS_IOS_TOOLBAR_SHOW_TABS: + return IsIPadIdiom(); + case IDS_IOS_TOOLS_MENU_READER_MODE: + return experimental_flags::IsReaderModeEnabled(); + case IDS_IOS_TOOLS_MENU_READING_LIST: + return reading_list::switches::IsReadingListEnabled(); + case IDS_IOS_TOOLS_MENU_SUGGESTIONS: + return experimental_flags::IsSuggestionsUIEnabled(); + case IDS_IOS_OPTIONS_REPORT_AN_ISSUE: + return !ios::GetChromeBrowserProvider() + ->GetUserFeedbackProvider() + ->IsUserFeedbackEnabled(); + default: + return true; + } +}
diff --git a/ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h b/ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h index d1f4d50..1f79583 100644 --- a/ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h +++ b/ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h
@@ -32,6 +32,7 @@ extern NSString* const kToolsMenuSettingsId; extern NSString* const kToolsMenuHelpId; extern NSString* const kToolsMenuSuggestionsId; +extern NSString* const kToolsMenuReadingListId; // Tools Popup Table Delegate Protocol @protocol ToolsPopupTableDelegate<NSObject>
diff --git a/ios/chrome/browser/web/blocked_popup_tab_helper_unittest.mm b/ios/chrome/browser/web/blocked_popup_tab_helper_unittest.mm index e56dd15..2e9050c 100644 --- a/ios/chrome/browser/web/blocked_popup_tab_helper_unittest.mm +++ b/ios/chrome/browser/web/blocked_popup_tab_helper_unittest.mm
@@ -6,6 +6,7 @@ #include "base/memory/ptr_util.h" #include "components/content_settings/core/browser/host_content_settings_map.h" +#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar_manager.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" @@ -39,6 +40,10 @@ BlockedPopupTabHelper* GetBlockedPopupTabHelper() { return BlockedPopupTabHelper::FromWebState(&web_state_); } + // Returns InfoBarManager attached to |web_state_|. + infobars::InfoBarManager* GetInfobarManager() { + return InfoBarManagerImpl::FromWebState(&web_state_); + } web::TestWebState web_state_; }; @@ -71,6 +76,33 @@ EXPECT_FALSE(GetBlockedPopupTabHelper()->ShouldBlockPopup(source_url2)); } +// Tests that allowing blocked popup calls |show_popup_handler| and allows +// future popups for the source url. +TEST_F(BlockedPopupTabHelperTest, AllowBlockedPopup) { + const GURL source_url("https://source-url"); + ASSERT_TRUE(GetBlockedPopupTabHelper()->ShouldBlockPopup(source_url)); + + // Block popup. + const GURL target_url("https://target-url"); + web::Referrer referrer(source_url, web::ReferrerPolicyDefault); + __block bool show_popup_handler_was_called = false; + web::BlockedPopupInfo popup_info(target_url, referrer, nil, ^{ + show_popup_handler_was_called = true; + }); + GetBlockedPopupTabHelper()->HandlePopup(popup_info); + + // Allow blocked popup. + ASSERT_EQ(1U, GetInfobarManager()->infobar_count()); + infobars::InfoBar* infobar = GetInfobarManager()->infobar_at(0); + auto delegate = infobar->delegate()->AsConfirmInfoBarDelegate(); + ASSERT_TRUE(delegate); + delegate->Accept(); + + // Verify that handler was called and popups are allowed for |test_url|. + EXPECT_TRUE(show_popup_handler_was_called); + EXPECT_FALSE(GetBlockedPopupTabHelper()->ShouldBlockPopup(source_url)); +} + // Tests that an infobar is added to the infobar manager when // BlockedPopupTabHelper::HandlePopup() is called. TEST_F(BlockedPopupTabHelperTest, ShowAndDismissInfoBar) { @@ -78,19 +110,17 @@ web::BlockedPopupInfo popup_info(test_url, web::Referrer(), nil, nil); // Check that there are no infobars showing and no registered observers. - infobars::InfoBarManager* infobar_manager = - InfoBarManagerImpl::FromWebState(&web_state_); - EXPECT_EQ(0U, infobar_manager->infobar_count()); + EXPECT_EQ(0U, GetInfobarManager()->infobar_count()); EXPECT_FALSE(IsObservingSources()); // Call |HandlePopup| to show an infobar. GetBlockedPopupTabHelper()->HandlePopup(popup_info); - ASSERT_EQ(1U, infobar_manager->infobar_count()); + ASSERT_EQ(1U, GetInfobarManager()->infobar_count()); EXPECT_TRUE(IsObservingSources()); // Dismiss the infobar and check that the tab helper no longer has any // registered observers. - infobar_manager->infobar_at(0)->RemoveSelf(); - EXPECT_EQ(0U, infobar_manager->infobar_count()); + GetInfobarManager()->infobar_at(0)->RemoveSelf(); + EXPECT_EQ(0U, GetInfobarManager()->infobar_count()); EXPECT_FALSE(IsObservingSources()); }
diff --git a/ios/clean/chrome/browser/ui/actions/tab_strip_actions.h b/ios/clean/chrome/browser/ui/actions/tab_strip_actions.h index bb46860..4dcd29be 100644 --- a/ios/clean/chrome/browser/ui/actions/tab_strip_actions.h +++ b/ios/clean/chrome/browser/ui/actions/tab_strip_actions.h
@@ -14,8 +14,10 @@ // Target/Action methods relating to the tab strip. @protocol TabStripActions @optional -// Reveals or hides the tab strip. -- (void)toggleTabStrip:(id)sender; +// Shows the tab strip. +- (void)showTabStrip:(id)sender; +// Hides the tab strip. +- (void)hideTabStrip:(id)sender; @end #endif // IOS_CLEAN_CHROME_BROWSER_UI_ACTIONS_TAB_STRIP_ACTIONS_H_
diff --git a/ios/clean/chrome/browser/ui/tab/BUILD.gn b/ios/clean/chrome/browser/ui/tab/BUILD.gn index a341ea1..b43a8c9 100644 --- a/ios/clean/chrome/browser/ui/tab/BUILD.gn +++ b/ios/clean/chrome/browser/ui/tab/BUILD.gn
@@ -4,8 +4,6 @@ source_set("tab") { sources = [ - "tab_container_view_controller.h", - "tab_container_view_controller.mm", "tab_coordinator.h", "tab_coordinator.mm", ] @@ -13,16 +11,30 @@ configs += [ "//build/config/compiler:enable_arc" ] deps = [ + ":tab_ui", "//base", "//ios/clean/chrome/browser", - "//ios/clean/chrome/browser/ui", "//ios/clean/chrome/browser/ui/actions", "//ios/clean/chrome/browser/ui/animators", "//ios/clean/chrome/browser/ui/ntp", - "//ios/clean/chrome/browser/ui/presenters", "//ios/clean/chrome/browser/ui/toolbar", "//ios/clean/chrome/browser/ui/web_contents", "//ios/shared/chrome/browser/coordinator_context", "//ios/web", ] } + +source_set("tab_ui") { + sources = [ + "tab_container_view_controller.h", + "tab_container_view_controller.mm", + ] + deps = [ + "//ios/clean/chrome/browser/ui", + "//ios/clean/chrome/browser/ui/animators", + "//ios/clean/chrome/browser/ui/presenters", + "//ios/clean/chrome/browser/ui/tab_strip:tab_strip_ui", + ] + libs = [ "UIKit.framework" ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/clean/chrome/browser/ui/tab/tab_container_view_controller.mm b/ios/clean/chrome/browser/ui/tab/tab_container_view_controller.mm index 06c398cd..792a6ab 100644 --- a/ios/clean/chrome/browser/ui/tab/tab_container_view_controller.mm +++ b/ios/clean/chrome/browser/ui/tab/tab_container_view_controller.mm
@@ -8,6 +8,7 @@ #import "ios/clean/chrome/browser/ui/tab/tab_container_view_controller.h" +#import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_events.h" #import "ios/clean/chrome/browser/ui/ui_types.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -224,10 +225,22 @@ } #pragma mark - TabStripActions +- (void)showTabStrip:(id)sender { + self.tabStripHeightConstraint.constant = kTabStripHeight; + // HACK: Remove fake action. + [[UIApplication sharedApplication] sendAction:@selector(tabStripDidShow:) + to:nil + from:sender + forEvent:nil]; +} -- (void)toggleTabStrip:(id)sender { - self.tabStripHeightConstraint.constant = - self.tabStripHeightConstraint.constant > 0.0f ? 0.0f : kTabStripHeight; +- (void)hideTabStrip:(id)sender { + self.tabStripHeightConstraint.constant = 0.0f; + // HACK: Remove fake action. + [[UIApplication sharedApplication] sendAction:@selector(tabStripDidHide:) + to:nil + from:sender + forEvent:nil]; } #pragma mark - Abstract methods to be overriden by subclass
diff --git a/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm b/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm index 9139cc9..3ccbaa6 100644 --- a/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm +++ b/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm
@@ -14,6 +14,7 @@ #include "base/memory/ptr_util.h" #import "ios/clean/chrome/browser/browser_coordinator+internal.h" #import "ios/clean/chrome/browser/ui/actions/tab_grid_actions.h" +#import "ios/clean/chrome/browser/ui/actions/tab_strip_actions.h" #import "ios/clean/chrome/browser/ui/animators/zoom_transition_animator.h" #import "ios/clean/chrome/browser/ui/ntp/new_tab_page_coordinator.h" #import "ios/clean/chrome/browser/ui/tab/tab_container_view_controller.h" @@ -77,9 +78,9 @@ // controller. UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; [button addTarget:nil - action:@selector(showTabGrid:) + action:@selector(hideTabStrip:) forControlEvents:UIControlEventTouchUpInside]; - [button setTitle:@"Tab grid" forState:UIControlStateNormal]; + [button setTitle:@"Hide Strip" forState:UIControlStateNormal]; button.frame = CGRectMake(10, 10, 100, 100); UIViewController* tabStripViewController = [[UIViewController alloc] init];
diff --git a/ios/clean/chrome/browser/ui/tab_strip/BUILD.gn b/ios/clean/chrome/browser/ui/tab_strip/BUILD.gn index 606f7132..adfa7cfc 100644 --- a/ios/clean/chrome/browser/ui/tab_strip/BUILD.gn +++ b/ios/clean/chrome/browser/ui/tab_strip/BUILD.gn
@@ -24,6 +24,7 @@ sources = [ "tab_strip_container_view_controller.h", "tab_strip_container_view_controller.mm", + "tab_strip_events.h", ] deps = [ "//base",
diff --git a/ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.mm b/ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.mm index 5a8c92fd..fd1cc8d 100644 --- a/ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.mm +++ b/ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.mm
@@ -159,9 +159,12 @@ #pragma mark - TabStripActions // Action to toggle visibility of tab strip. -- (void)toggleTabStrip:(id)sender { - self.stripHeightConstraint.constant = - self.stripHeightConstraint.constant > 0 ? 0.0 : kStripHeight; +- (void)showTabStrip:(id)sender { + self.stripHeightConstraint.constant = kStripHeight; +} + +- (void)hideTabStrip:(id)sender { + self.stripHeightConstraint.constant = 0.0f; } #pragma mark - MenuPresentationDelegate
diff --git a/ios/clean/chrome/browser/ui/tab_strip/tab_strip_events.h b/ios/clean/chrome/browser/ui/tab_strip/tab_strip_events.h new file mode 100644 index 0000000..8c5c4f8 --- /dev/null +++ b/ios/clean/chrome/browser/ui/tab_strip/tab_strip_events.h
@@ -0,0 +1,20 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CLEAN_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_EVENTS_H_ +#define IOS_CLEAN_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_EVENTS_H_ + +#import <Foundation/Foundation.h> + +// PLACEHOLDER: TabStrip related events, this might change or be renamed once we +// figure out the command architecture. +@protocol TabStripEvents +@optional +// Event triggered when the TabStrip has been hidden. +- (void)tabStripDidHide:(id)sender; +// Event triggered when the TabStrip has been shown. +- (void)tabStripDidShow:(id)sender; +@end + +#endif // IOS_CLEAN_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_EVENTS_H_
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.h b/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.h index 274df273..f364c6e 100644 --- a/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.h +++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.h
@@ -17,8 +17,10 @@ + (instancetype)backToolbarButton; // Forward ToolbarButton. + (instancetype)forwardToolbarButton; -// Tab Switcher ToolbarButton. -+ (instancetype)tabSwitcherToolbarButton; +// Tab Switcher Strip ToolbarButton. ++ (instancetype)tabSwitcherStripToolbarButton; +// Tab Switcher Grid ToolbarButton. ++ (instancetype)tabSwitcherGridToolbarButton; // Tools Menu ToolbarButton. + (instancetype)toolsMenuToolbarButton; // Share ToolbarButton.
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm index b83728d3..a0fe3b0 100644 --- a/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm +++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm
@@ -43,13 +43,18 @@ return forwardButton; } -+ (instancetype)tabSwitcherToolbarButton { - ToolbarButton* tabSwitcherButton = - [self toolbarButtonWithImageForNormalState: - [UIImage imageNamed:@"tabswitcher_tab_switcher_button"] - imageForHighlightedState:nil - imageForDisabledState:nil]; - return tabSwitcherButton; ++ (instancetype)tabSwitcherStripToolbarButton { + return [self toolbarButtonWithImageForNormalState: + [UIImage imageNamed:@"tabswitcher_open_tabs"] + imageForHighlightedState:nil + imageForDisabledState:nil]; +} + ++ (instancetype)tabSwitcherGridToolbarButton { + return [self toolbarButtonWithImageForNormalState: + [UIImage imageNamed:@"tabswitcher_tab_switcher_button"] + imageForHighlightedState:nil + imageForDisabledState:nil]; } + (instancetype)toolsMenuToolbarButton {
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_button.h b/ios/clean/chrome/browser/ui/toolbar/toolbar_button.h index a145b83b..4a968b2 100644 --- a/ios/clean/chrome/browser/ui/toolbar/toolbar_button.h +++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_button.h
@@ -16,7 +16,8 @@ @property(nonatomic, assign) ToolbarComponentVisibility visibilityMask; // Returns true if the ToolbarButton should be hidden in the current SizeClass. @property(nonatomic, assign) BOOL hiddenInCurrentSizeClass; -// Returns true if the ToolbarButton should be hidden due to a current WebState. +// Returns true if the ToolbarButton should be hidden due to a current UI state +// or WebState. @property(nonatomic, assign) BOOL hiddenInCurrentState; // Returns a ToolbarButton using the three images parameters for their // respective state.
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm index 57335f8..35850be6 100644 --- a/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm +++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm
@@ -10,6 +10,7 @@ #import "base/mac/foundation_util.h" #import "ios/clean/chrome/browser/ui/actions/navigation_actions.h" +#import "ios/clean/chrome/browser/ui/actions/tab_grid_actions.h" #import "ios/clean/chrome/browser/ui/actions/tab_strip_actions.h" #import "ios/clean/chrome/browser/ui/actions/tools_menu_actions.h" #import "ios/clean/chrome/browser/ui/commands/toolbar_commands.h" @@ -32,7 +33,8 @@ @property(nonatomic, strong) UIStackView* stackView; @property(nonatomic, strong) ToolbarButton* backButton; @property(nonatomic, strong) ToolbarButton* forwardButton; -@property(nonatomic, strong) ToolbarButton* tabSwitcherButton; +@property(nonatomic, strong) ToolbarButton* tabSwitchStripButton; +@property(nonatomic, strong) ToolbarButton* tabSwitchGridButton; @property(nonatomic, strong) ToolbarButton* toolsMenuButton; @property(nonatomic, strong) ToolbarButton* shareButton; @property(nonatomic, strong) ToolbarButton* reloadButton; @@ -45,7 +47,8 @@ @synthesize omnibox = _omnibox; @synthesize backButton = _backButton; @synthesize forwardButton = _forwardButton; -@synthesize tabSwitcherButton = _tabSwitcherButton; +@synthesize tabSwitchStripButton = _tabSwitchStripButton; +@synthesize tabSwitchGridButton = _tabSwitchGridButton; @synthesize toolsMenuButton = _toolsMenuButton; @synthesize shareButton = _shareButton; @synthesize reloadButton = _reloadButton; @@ -66,8 +69,10 @@ // Stack view to contain toolbar items. self.stackView = [[UIStackView alloc] initWithArrangedSubviews:@[ self.backButton, self.forwardButton, self.reloadButton, self.stopButton, - omnibox, self.shareButton, self.tabSwitcherButton, self.toolsMenuButton + omnibox, self.shareButton, self.tabSwitchStripButton, + self.tabSwitchGridButton, self.toolsMenuButton ]]; + [self updateAllButtonsVisibility]; self.stackView.translatesAutoresizingMaskIntoConstraints = NO; self.stackView.spacing = 16.0; self.stackView.distribution = UIStackViewDistributionFillProportionally; @@ -115,14 +120,24 @@ action:@selector(goForward:) forControlEvents:UIControlEventTouchUpInside]; - // Tab switcher button. - self.tabSwitcherButton = [ToolbarButton tabSwitcherToolbarButton]; - self.tabSwitcherButton.visibilityMask = + // Tab switcher Strip button. + self.tabSwitchStripButton = [ToolbarButton tabSwitcherStripToolbarButton]; + self.tabSwitchStripButton.visibilityMask = ToolbarComponentVisibilityCompactWidth | ToolbarComponentVisibilityRegularWidth; - [self.tabSwitcherButton addTarget:nil - action:@selector(toggleTabStrip:) - forControlEvents:UIControlEventTouchUpInside]; + [self.tabSwitchStripButton addTarget:nil + action:@selector(showTabStrip:) + forControlEvents:UIControlEventTouchUpInside]; + + // Tab switcher Grid button. + self.tabSwitchGridButton = [ToolbarButton tabSwitcherGridToolbarButton]; + self.tabSwitchGridButton.visibilityMask = + ToolbarComponentVisibilityCompactWidth | + ToolbarComponentVisibilityRegularWidth; + [self.tabSwitchGridButton addTarget:nil + action:@selector(showTabGrid:) + forControlEvents:UIControlEventTouchUpInside]; + self.tabSwitchGridButton.hiddenInCurrentState = YES; // Tools menu button. self.toolsMenuButton = [ToolbarButton toolsMenuToolbarButton]; @@ -194,6 +209,20 @@ [self.toolbarCommandHandler closeToolsMenu]; } +#pragma mark - TabStripEvents + +- (void)tabStripDidShow:(id)sender { + self.tabSwitchStripButton.hiddenInCurrentState = YES; + self.tabSwitchGridButton.hiddenInCurrentState = NO; + [self updateAllButtonsVisibility]; +} + +- (void)tabStripDidHide:(id)sender { + self.tabSwitchStripButton.hiddenInCurrentState = NO; + self.tabSwitchGridButton.hiddenInCurrentState = YES; + [self updateAllButtonsVisibility]; +} + #pragma mark - Helper Methods // PLACEHOLDER: We are not sure yet how WebState changes will affect Toolbar
diff --git a/ios/showcase/common/BUILD.gn b/ios/showcase/common/BUILD.gn index 8a5dcd14..dac7a08 100644 --- a/ios/showcase/common/BUILD.gn +++ b/ios/showcase/common/BUILD.gn
@@ -5,6 +5,7 @@ source_set("common") { sources = [ "coordinator.h", + "navigation_coordinator.h", "protocol_alerter.h", "protocol_alerter.mm", ]
diff --git a/ios/showcase/common/navigation_coordinator.h b/ios/showcase/common/navigation_coordinator.h new file mode 100644 index 0000000..3ec8e58f --- /dev/null +++ b/ios/showcase/common/navigation_coordinator.h
@@ -0,0 +1,21 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_COMMON_NAVIGATION_COORDINATOR_H_ +#define IOS_SHOWCASE_COMMON_NAVIGATION_COORDINATOR_H_ + +#import <Foundation/Foundation.h> + +#import "ios/showcase/common/coordinator.h" + +// This protocol is a specialization of the Coordinator protocol when the driven +// view controller is pushed on a navigation controller. +@protocol NavigationCoordinator<Coordinator> + +// Redefined to be a UINavigationController. +@property(nonatomic, weak) UINavigationController* baseViewController; + +@end + +#endif // IOS_SHOWCASE_COMMON_NAVIGATION_COORDINATOR_H_
diff --git a/ios/showcase/common/protocol_alerter.h b/ios/showcase/common/protocol_alerter.h index 02ad7645..4eb6afc 100644 --- a/ios/showcase/common/protocol_alerter.h +++ b/ios/showcase/common/protocol_alerter.h
@@ -17,7 +17,7 @@ // protocols in |protocols|. - (instancetype)initWithProtocols:(NSArray<Protocol*>*)protocols; -// The view controller (if any)_ that will be used to present alerts. +// The view controller (if any) that will be used to present alerts. @property(nonatomic, weak) UIViewController* baseViewController; @end
diff --git a/ios/showcase/settings/sc_settings_coordinator.h b/ios/showcase/settings/sc_settings_coordinator.h index b611b7c..3a4cd8c5 100644 --- a/ios/showcase/settings/sc_settings_coordinator.h +++ b/ios/showcase/settings/sc_settings_coordinator.h
@@ -7,13 +7,9 @@ #import <UIKit/UIKit.h> -#import "ios/showcase/common/coordinator.h" +#import "ios/showcase/common/navigation_coordinator.h" -@interface SCSettingsCoordinator : NSObject<Coordinator> - -// Redefined to be a UINavigationController. -@property(nonatomic, weak) UINavigationController* baseViewController; - +@interface SCSettingsCoordinator : NSObject<NavigationCoordinator> @end #endif // IOS_SHOWCASE_SETTINGS_SC_SETTINGS_COORDINATOR_H_
diff --git a/ios/showcase/suggestions/sc_suggestions_coordinator.h b/ios/showcase/suggestions/sc_suggestions_coordinator.h index 695af48..d6700db 100644 --- a/ios/showcase/suggestions/sc_suggestions_coordinator.h +++ b/ios/showcase/suggestions/sc_suggestions_coordinator.h
@@ -7,13 +7,9 @@ #import <UIKit/UIKit.h> -#import "ios/showcase/common/coordinator.h" +#import "ios/showcase/common/navigation_coordinator.h" -@interface SCSuggestionsCoordinator : NSObject<Coordinator> - -// Redefined to be a UINavigationController. -@property(nonatomic, weak) UINavigationController* baseViewController; - +@interface SCSuggestionsCoordinator : NSObject<NavigationCoordinator> @end #endif // IOS_SHOWCASE_SUGGESTIONS_SC_SUGGESTIONS_COORDINATOR_H_
diff --git a/ios/showcase/tab_grid/sc_tab_grid_coordinator.h b/ios/showcase/tab_grid/sc_tab_grid_coordinator.h index 0ae9780..9ad6e4d 100644 --- a/ios/showcase/tab_grid/sc_tab_grid_coordinator.h +++ b/ios/showcase/tab_grid/sc_tab_grid_coordinator.h
@@ -7,11 +7,9 @@ #import <UIKit/UIKit.h> -#import "ios/showcase/common/coordinator.h" +#import "ios/showcase/common/navigation_coordinator.h" -@interface SCTabGridCoordinator : NSObject<Coordinator> -// Redefined to be a UINavigationController. -@property(nonatomic, weak) UINavigationController* baseViewController; +@interface SCTabGridCoordinator : NSObject<NavigationCoordinator> @end #endif // IOS_SHOWCASE_TAB_GRID_SC_TAB_GRID_COORDINATOR_H_
diff --git a/ios/showcase/tab_strip/sc_tab_strip_coordinator.h b/ios/showcase/tab_strip/sc_tab_strip_coordinator.h index 6a12493..9e4e781 100644 --- a/ios/showcase/tab_strip/sc_tab_strip_coordinator.h +++ b/ios/showcase/tab_strip/sc_tab_strip_coordinator.h
@@ -7,11 +7,9 @@ #import <UIKit/UIKit.h> -#import "ios/showcase/common/coordinator.h" +#import "ios/showcase/common/navigation_coordinator.h" -@interface SCTabStripCoordinator : NSObject<Coordinator> -// Redefined to be a UINavigationController. -@property(nonatomic, weak) UINavigationController* baseViewController; +@interface SCTabStripCoordinator : NSObject<NavigationCoordinator> @end #endif // IOS_SHOWCASE_TAB_STRIP_SC_TAB_STRIP_COORDINATOR_H_
diff --git a/ios/showcase/tab_strip/sc_tab_strip_coordinator.mm b/ios/showcase/tab_strip/sc_tab_strip_coordinator.mm index f6e5346..ab874040 100644 --- a/ios/showcase/tab_strip/sc_tab_strip_coordinator.mm +++ b/ios/showcase/tab_strip/sc_tab_strip_coordinator.mm
@@ -25,7 +25,7 @@ UIViewController* greenViewController = [self viewControllerWithButtonTitle:@"toggleStrip" - action:@selector(toggleTabStrip:)]; + action:@selector(hideTabStrip:)]; greenViewController.view.backgroundColor = [UIColor greenColor]; self.viewController = [[TabStripContainerViewController alloc] init];
diff --git a/ios/showcase/toolbar/sc_toolbar_coordinator.h b/ios/showcase/toolbar/sc_toolbar_coordinator.h index ff6fe19e..8f404f29 100644 --- a/ios/showcase/toolbar/sc_toolbar_coordinator.h +++ b/ios/showcase/toolbar/sc_toolbar_coordinator.h
@@ -7,12 +7,9 @@ #import <UIKit/UIKit.h> -#import "ios/showcase/common/coordinator.h" +#import "ios/showcase/common/navigation_coordinator.h" -@interface SCToolbarCoordinator : NSObject<Coordinator> -// Redefined to be a UINavigationController. -@property(nonatomic, weak) UINavigationController* baseViewController; - +@interface SCToolbarCoordinator : NSObject<NavigationCoordinator> @end #endif // IOS_SHOWCASE_TOOLBAR_SC_TOOLBAR_COORDINATOR_H_
diff --git a/ios/third_party/material_components_ios/README.chromium b/ios/third_party/material_components_ios/README.chromium index 7ee04302..17211b8 100644 --- a/ios/third_party/material_components_ios/README.chromium +++ b/ios/third_party/material_components_ios/README.chromium
@@ -1,7 +1,7 @@ Name: Material Components for iOS URL: https://github.com/material-components/material-components-ios Version: 0 -Revision: 31d5812485c52a53074a971efb32438a2d5d241f +Revision: 6752ec5219edd41b625a39f58793df3663cc5861 License: Apache 2.0 License File: LICENSE Security Critical: yes
diff --git a/ios/web/web_state/ui/crw_web_controller_unittest.mm b/ios/web/web_state/ui/crw_web_controller_unittest.mm index 5f076056..3a52ccdc 100644 --- a/ios/web/web_state/ui/crw_web_controller_unittest.mm +++ b/ios/web/web_state/ui/crw_web_controller_unittest.mm
@@ -128,6 +128,9 @@ namespace { +// Syntactically invalid URL per rfc3986. +const char kInvalidURL[] = "http://%3"; + const char kTestURLString[] = "http://www.google.com/"; const char kTestAppSpecificURL[] = "testwebui://test/"; @@ -687,6 +690,28 @@ web::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP); } +// Real WKWebView is required for CRWWebControllerInvalidUrlTest. +typedef web::WebTestWithWebState CRWWebControllerInvalidUrlTest; + +// Tests that web controller navigates to about:blank if invalid URL is loaded. +TEST_F(CRWWebControllerInvalidUrlTest, LoadInvalidURL) { + GURL url(kInvalidURL); + ASSERT_FALSE(url.is_valid()); + LoadHtml(@"<html><body></body></html>", url); + EXPECT_EQ(GURL(url::kAboutBlankURL), web_state()->GetLastCommittedURL()); +} + +// Tests that web controller does not navigate to about:blank if iframe src +// has invalid url. Web controller loads about:blank if page navigates to +// invalid url, but should do nothing if navigation is performed in iframe. This +// test prevents crbug.com/694865 regression. +TEST_F(CRWWebControllerInvalidUrlTest, IFrameWithInvalidURL) { + GURL url("http://chromium.test"); + ASSERT_FALSE(GURL(kInvalidURL).is_valid()); + LoadHtml([NSString stringWithFormat:@"<iframe src='%s'/>", kInvalidURL], url); + EXPECT_EQ(url, web_state()->GetLastCommittedURL()); +} + // Real WKWebView is required for CRWWebControllerFormActivityTest. typedef web::WebTestWithWebController CRWWebControllerFormActivityTest;
diff --git a/ios/web_view/internal/BUILD.gn b/ios/web_view/internal/BUILD.gn index 80111e55..f9669a7 100644 --- a/ios/web_view/internal/BUILD.gn +++ b/ios/web_view/internal/BUILD.gn
@@ -9,7 +9,6 @@ ] sources = [ - "criwv.mm", "criwv_browser_state.h", "criwv_browser_state.mm", "criwv_network_delegate.cc", @@ -22,6 +21,7 @@ "criwv_web_main_delegate.mm", "criwv_web_main_parts.h", "criwv_web_main_parts.mm", + "cwv.mm", "cwv_web_view.mm", "cwv_web_view_configuration.mm", "cwv_website_data_store.mm",
diff --git a/ios/web_view/internal/criwv_browser_state.h b/ios/web_view/internal/criwv_browser_state.h index 9851667..cb2e4f8 100644 --- a/ios/web_view/internal/criwv_browser_state.h +++ b/ios/web_view/internal/criwv_browser_state.h
@@ -21,7 +21,7 @@ class CRIWVURLRequestContextGetter; -// CRIWV implementation of BrowserState. Can only be called from the UI thread. +// CWV implementation of BrowserState. Can only be called from the UI thread. class CRIWVBrowserState : public web::BrowserState { public: explicit CRIWVBrowserState(bool off_the_record);
diff --git a/ios/web_view/internal/criwv_network_delegate.h b/ios/web_view/internal/criwv_network_delegate.h index 29858074..2bbb4a7 100644 --- a/ios/web_view/internal/criwv_network_delegate.h +++ b/ios/web_view/internal/criwv_network_delegate.h
@@ -10,7 +10,7 @@ namespace ios_web_view { -// CRIWV-specific implementation of NetworkDelegate. +// CWV-specific implementation of NetworkDelegate. class CRIWVNetworkDelegate : public net::NetworkDelegateImpl { public: CRIWVNetworkDelegate();
diff --git a/ios/web_view/internal/criwv_url_request_context_getter.h b/ios/web_view/internal/criwv_url_request_context_getter.h index ad0f5cff..78150f4a 100644 --- a/ios/web_view/internal/criwv_url_request_context_getter.h +++ b/ios/web_view/internal/criwv_url_request_context_getter.h
@@ -23,7 +23,7 @@ namespace ios_web_view { -// CRIWV-specific implementation of URLRequestContextGetter. +// CWV-specific implementation of URLRequestContextGetter. class CRIWVURLRequestContextGetter : public net::URLRequestContextGetter { public: CRIWVURLRequestContextGetter(
diff --git a/ios/web_view/internal/criwv_web_client.h b/ios/web_view/internal/criwv_web_client.h index 71cd52c4..a6960a94 100644 --- a/ios/web_view/internal/criwv_web_client.h +++ b/ios/web_view/internal/criwv_web_client.h
@@ -15,7 +15,7 @@ class CRIWVBrowserState; class CRIWVWebMainParts; -// CRIWV-specific implementation of WebClient. Delegates some functionality to +// CWV-specific implementation of WebClient. Delegates some functionality to // CWVDelegate. class CRIWVWebClient : public web::WebClient { public:
diff --git a/ios/web_view/internal/criwv_web_main_delegate.h b/ios/web_view/internal/criwv_web_main_delegate.h index cc38796..98696da 100644 --- a/ios/web_view/internal/criwv_web_main_delegate.h +++ b/ios/web_view/internal/criwv_web_main_delegate.h
@@ -14,7 +14,7 @@ namespace ios_web_view { class CRIWVWebClient; -// CRIWV-specific implementation of WebMainDelegate. +// CWV-specific implementation of WebMainDelegate. class CRIWVWebMainDelegate : public web::WebMainDelegate { public: explicit CRIWVWebMainDelegate(id<CWVDelegate> delegate);
diff --git a/ios/web_view/internal/criwv_web_main_parts.h b/ios/web_view/internal/criwv_web_main_parts.h index 18885e26..927de68a 100644 --- a/ios/web_view/internal/criwv_web_main_parts.h +++ b/ios/web_view/internal/criwv_web_main_parts.h
@@ -14,7 +14,7 @@ namespace ios_web_view { class CRIWVBrowserState; -// CRIWV-specific implementation of WebMainParts. +// CWV-specific implementation of WebMainParts. class CRIWVWebMainParts : public web::WebMainParts { public: explicit CRIWVWebMainParts(id<CWVDelegate> delegate);
diff --git a/ios/web_view/internal/criwv.mm b/ios/web_view/internal/cwv.mm similarity index 91% rename from ios/web_view/internal/criwv.mm rename to ios/web_view/internal/cwv.mm index 825c829..62248ac 100644 --- a/ios/web_view/internal/criwv.mm +++ b/ios/web_view/internal/cwv.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/web_view/public/criwv.h" +#import "ios/web_view/public/cwv.h" #include <memory> @@ -22,10 +22,10 @@ #endif namespace { -CRIWV* g_criwv = nil; +CWV* g_criwv = nil; } -@interface CRIWV () { +@interface CWV () { std::unique_ptr<ios_web_view::CRIWVWebMainDelegate> _webMainDelegate; std::unique_ptr<web::WebMain> _webMain; } @@ -35,12 +35,12 @@ - (instancetype)initWithDelegate:(id<CWVDelegate>)delegate; @end -@implementation CRIWV +@implementation CWV @synthesize delegate = _delegate; + (void)configureWithDelegate:(id<CWVDelegate>)delegate { - g_criwv = [[CRIWV alloc] initWithDelegate:delegate]; + g_criwv = [[CWV alloc] initWithDelegate:delegate]; } + (void)shutDown {
diff --git a/ios/web_view/public/BUILD.gn b/ios/web_view/public/BUILD.gn index 15a18fc..fd7d921 100644 --- a/ios/web_view/public/BUILD.gn +++ b/ios/web_view/public/BUILD.gn
@@ -9,8 +9,8 @@ ] sources = [ - "criwv.h", "criwv_translate_manager.h", + "cwv.h", "cwv_delegate.h", "cwv_translate_delegate.h", "cwv_web_view.h",
diff --git a/ios/web_view/public/criwv.h b/ios/web_view/public/criwv.h deleted file mode 100644 index b700569..0000000 --- a/ios/web_view/public/criwv.h +++ /dev/null
@@ -1,31 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef IOS_WEB_VIEW_PUBLIC_CRIWV_H_ -#define IOS_WEB_VIEW_PUBLIC_CRIWV_H_ - -#import <CoreGraphics/CoreGraphics.h> -#import <Foundation/Foundation.h> - -@protocol CWVDelegate; -@class CWVWebView; - -// Main interface for the CRIWV library. -__attribute__((visibility("default"))) -@interface CRIWV : NSObject - -// Initializes the CRIWV library. This function should be called from -// |application:didFinishLaunchingWithOptions:|. -+ (void)configureWithDelegate:(id<CWVDelegate>)delegate; - -// Shuts down the CRIWV library. This function should be called from -// |applicationwillTerminate:|. -+ (void)shutDown; - -// Creates and returns a web view. -+ (CWVWebView*)webViewWithFrame:(CGRect)frame; - -@end - -#endif // IOS_WEB_VIEW_PUBLIC_CRIWV_H_
diff --git a/ios/web_view/public/cwv.h b/ios/web_view/public/cwv.h new file mode 100644 index 0000000..503d5f7 --- /dev/null +++ b/ios/web_view/public/cwv.h
@@ -0,0 +1,30 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_WEB_VIEW_PUBLIC_CWV_H_ +#define IOS_WEB_VIEW_PUBLIC_CWV_H_ + +#import <CoreGraphics/CoreGraphics.h> +#import <Foundation/Foundation.h> + +@protocol CWVDelegate; +@class CWVWebView; + +// Main interface for the CWV library. +__attribute__((visibility("default"))) @interface CWV : NSObject + +// Initializes the CWV library. This function should be called from +// |application:didFinishLaunchingWithOptions:|. ++ (void)configureWithDelegate:(id<CWVDelegate>)delegate; + +// Shuts down the CWV library. This function should be called from +// |applicationwillTerminate:|. ++ (void)shutDown; + +// Creates and returns a web view. ++ (CWVWebView*)webViewWithFrame:(CGRect)frame; + +@end + +#endif // IOS_WEB_VIEW_PUBLIC_CWV_H_
diff --git a/ios/web_view/public/cwv_delegate.h b/ios/web_view/public/cwv_delegate.h index cd09b9c..8000a2e 100644 --- a/ios/web_view/public/cwv_delegate.h +++ b/ios/web_view/public/cwv_delegate.h
@@ -6,7 +6,7 @@ @class NSString; -// Delegate interface for the CRIWV library. Embedders can implement the +// Delegate interface for the CWV library. Embedders can implement the // functions in order to customize library behavior. @protocol CWVDelegate
diff --git a/ios/web_view/public/cwv_web_view.h b/ios/web_view/public/cwv_web_view.h index 81a54a3..09a916c 100644 --- a/ios/web_view/public/cwv_web_view.h +++ b/ios/web_view/public/cwv_web_view.h
@@ -15,7 +15,7 @@ // In addition to WKWebView features, it allows Translate, Find In Page, // Customizable Context Menus, and maybe more. // -// Concrete instances can be created through CRIWV. +// Concrete instances can be created through CWV. @interface CWVWebView : UIView // The view used to display web content.
diff --git a/ios/web_view/shell/shell_app_delegate.m b/ios/web_view/shell/shell_app_delegate.m index 28a4b7d..d69c6232 100644 --- a/ios/web_view/shell/shell_app_delegate.m +++ b/ios/web_view/shell/shell_app_delegate.m
@@ -4,7 +4,7 @@ #import "ios/web_view/shell/shell_app_delegate.h" -#import "ios/web_view/public/criwv.h" +#import "ios/web_view/public/cwv.h" #import "ios/web_view/shell/shell_delegate.h" #import "ios/web_view/shell/shell_view_controller.h" @@ -27,7 +27,7 @@ self.window.backgroundColor = [UIColor whiteColor]; self.delegate = [[ShellDelegate alloc] init]; - [CRIWV configureWithDelegate:_delegate]; + [CWV configureWithDelegate:_delegate]; [self.window makeKeyAndVisible]; @@ -50,7 +50,7 @@ } - (void)applicationWillTerminate:(UIApplication*)application { - [CRIWV shutDown]; + [CWV shutDown]; } @end
diff --git a/ios/web_view/shell/shell_view_controller.m b/ios/web_view/shell/shell_view_controller.m index f1b5f89..c95398b1 100644 --- a/ios/web_view/shell/shell_view_controller.m +++ b/ios/web_view/shell/shell_view_controller.m
@@ -4,7 +4,7 @@ #import "ios/web_view/shell/shell_view_controller.h" -#import "ios/web_view/public/criwv.h" +#import "ios/web_view/public/cwv.h" #import "ios/web_view/public/cwv_web_view.h" #import "ios/web_view/shell/translate_controller.h" @@ -19,7 +19,7 @@ @property(nonatomic, strong) UITextField* field; // Toolbar containing navigation buttons and |field|. @property(nonatomic, strong) UIToolbar* toolbar; -// CRIWV view which renders the web page. +// CWV view which renders the web page. @property(nonatomic, strong) CWVWebView* webView; // Handles the translation of the content displayed in |webView|. @property(nonatomic, strong) TranslateController* translateController; @@ -120,7 +120,7 @@ [_toolbar addSubview:stop]; [_toolbar addSubview:_field]; - self.webView = [CRIWV webViewWithFrame:[_containerView bounds]]; + self.webView = [CWV webViewWithFrame:[_containerView bounds]]; [_webView setDelegate:self]; [_webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index 7c395746..7929ecd 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc
@@ -240,6 +240,7 @@ params.max_keyframe_distance_to_disable_background_video()), enable_instant_source_buffer_gc_( params.enable_instant_source_buffer_gc()) { + DVLOG(1) << __func__; DCHECK(!adjust_allocated_memory_cb_.is_null()); DCHECK(renderer_factory_); DCHECK(client_); @@ -272,8 +273,15 @@ } WebMediaPlayerImpl::~WebMediaPlayerImpl() { + DVLOG(1) << __func__; DCHECK(main_task_runner_->BelongsToCurrentThread()); + if (set_cdm_result_) { + DVLOG(2) << "Resolve pending SetCdm() when media player is destroyed."; + set_cdm_result_->complete(); + set_cdm_result_.reset(); + } + suppress_destruction_errors_ = true; delegate_->PlayerGone(delegate_id_); @@ -301,6 +309,7 @@ void WebMediaPlayerImpl::load(LoadType load_type, const blink::WebMediaPlayerSource& source, CORSMode cors_mode) { + DVLOG(1) << __func__; // Only URL or MSE blob URL is supported. DCHECK(source.isURL()); blink::WebURL url = source.getAsURL(); @@ -968,6 +977,7 @@ void WebMediaPlayerImpl::setContentDecryptionModule( blink::WebContentDecryptionModule* cdm, blink::WebContentDecryptionModuleResult result) { + DVLOG(1) << __func__ << ": cdm = " << cdm; DCHECK(main_task_runner_->BelongsToCurrentThread()); // Once the CDM is set it can't be cleared as there may be frames being @@ -1072,6 +1082,7 @@ } void WebMediaPlayerImpl::OnCdmAttached(bool success) { + DVLOG(1) << __func__ << ": success = " << success; DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK(pending_cdm_);
diff --git a/media/renderers/renderer_impl.cc b/media/renderers/renderer_impl.cc index 3abc020..8d63547 100644 --- a/media/renderers/renderer_impl.cc +++ b/media/renderers/renderer_impl.cc
@@ -143,6 +143,7 @@ init_cb_ = init_cb; if (HasEncryptedStream() && !cdm_context_) { + DVLOG(1) << __func__ << ": Has encrypted stream but CDM is not set."; state_ = STATE_INIT_PENDING_CDM; return; }
diff --git a/net/cert/cert_verify_proc_android.cc b/net/cert/cert_verify_proc_android.cc index e0a442a..3898168f 100644 --- a/net/cert/cert_verify_proc_android.cc +++ b/net/cert/cert_verify_proc_android.cc
@@ -23,6 +23,7 @@ #include "net/cert/internal/cert_errors.h" #include "net/cert/internal/parsed_certificate.h" #include "net/cert/x509_certificate.h" +#include "net/cert/x509_util.h" #include "third_party/boringssl/src/include/openssl/x509v3.h" #include "url/gurl.h" @@ -112,7 +113,9 @@ return false; CertErrors errors; return ParsedCertificate::CreateAndAddToVector( - aia_fetch_bytes.data(), aia_fetch_bytes.size(), {}, cert_list, &errors); + x509_util::CreateCryptoBuffer(aia_fetch_bytes.data(), + aia_fetch_bytes.size()), + {}, cert_list, &errors); } // Uses android::VerifyX509CertChain() to verify the certificates in |certs| for @@ -175,7 +178,8 @@ CertErrors errors; ParsedCertificateList certs; for (const auto& cert : cert_bytes) { - if (!ParsedCertificate::CreateAndAddToVector(cert, {}, &certs, &errors)) { + if (!ParsedCertificate::CreateAndAddToVector( + x509_util::CreateCryptoBuffer(cert), {}, &certs, &errors)) { return android::CERT_VERIFY_STATUS_ANDROID_NO_TRUSTED_ROOT; } }
diff --git a/net/cert/cert_verify_proc_mac.cc b/net/cert/cert_verify_proc_mac.cc index 46d1cc86..15d07f3 100644 --- a/net/cert/cert_verify_proc_mac.cc +++ b/net/cert/cert_verify_proc_mac.cc
@@ -35,6 +35,7 @@ #include "net/cert/test_keychain_search_list_mac.h" #include "net/cert/test_root_certs.h" #include "net/cert/x509_certificate.h" +#include "net/cert/x509_util.h" #include "net/cert/x509_util_mac.h" // CSSM functions are deprecated as of OSX 10.7, but have no replacement. @@ -295,8 +296,8 @@ return; } - scoped_refptr<ParsedCertificate> cert( - ParsedCertificate::Create(der_cert, {}, nullptr)); + scoped_refptr<ParsedCertificate> cert(ParsedCertificate::Create( + x509_util::CreateCryptoBuffer(der_cert), {}, nullptr)); if (!cert) return; @@ -346,7 +347,8 @@ if (!X509Certificate::GetDEREncoded(os_cert_chain[i], &der_cert)) return false; scoped_refptr<ParsedCertificate> intermediate_cert( - ParsedCertificate::Create(der_cert, {}, nullptr)); + ParsedCertificate::Create(x509_util::CreateCryptoBuffer(der_cert), {}, + nullptr)); if (!intermediate_cert) return false; if (!HasPolicyOrAnyPolicy(intermediate_cert.get(), ev_policy_oid))
diff --git a/net/cert/internal/cert_issuer_source_aia.cc b/net/cert/internal/cert_issuer_source_aia.cc index 6e1290a..8ddb9a00a 100644 --- a/net/cert/internal/cert_issuer_source_aia.cc +++ b/net/cert/internal/cert_issuer_source_aia.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "net/cert/cert_net_fetcher.h" #include "net/cert/internal/cert_errors.h" +#include "net/cert/x509_util.h" #include "url/gurl.h" namespace net { @@ -81,7 +82,9 @@ // TODO(eroman): Avoid copying bytes in the certificate? CertErrors errors; if (!ParsedCertificate::CreateAndAddToVector( - fetched_bytes.data(), fetched_bytes.size(), {}, results, &errors)) { + x509_util::CreateCryptoBuffer(fetched_bytes.data(), + fetched_bytes.size()), + {}, results, &errors)) { // TODO(crbug.com/634443): propagate error info. LOG(ERROR) << "Error parsing cert retrieved from AIA:\n" << errors.ToDebugString();
diff --git a/net/cert/internal/cert_issuer_source_aia_unittest.cc b/net/cert/internal/cert_issuer_source_aia_unittest.cc index f81c33d..b332dee 100644 --- a/net/cert/internal/cert_issuer_source_aia_unittest.cc +++ b/net/cert/internal/cert_issuer_source_aia_unittest.cc
@@ -10,6 +10,7 @@ #include "net/cert/internal/cert_errors.h" #include "net/cert/internal/parsed_certificate.h" #include "net/cert/internal/test_helpers.h" +#include "net/cert/x509_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -44,7 +45,8 @@ if (!r) return r; CertErrors errors; - *result = ParsedCertificate::Create(der, {}, &errors); + *result = ParsedCertificate::Create(x509_util::CreateCryptoBuffer(der), {}, + &errors); if (!*result) { return ::testing::AssertionFailure() << "ParsedCertificate::Create() failed:\n"
diff --git a/net/cert/internal/cert_issuer_source_nss.cc b/net/cert/internal/cert_issuer_source_nss.cc index 418efe3..24218e88 100644 --- a/net/cert/internal/cert_issuer_source_nss.cc +++ b/net/cert/internal/cert_issuer_source_nss.cc
@@ -10,6 +10,7 @@ #include "crypto/nss_util.h" #include "net/cert/internal/cert_errors.h" #include "net/cert/internal/parsed_certificate.h" +#include "net/cert/x509_util.h" namespace net { @@ -40,7 +41,9 @@ !CERT_LIST_END(node, found_certs); node = CERT_LIST_NEXT(node)) { CertErrors errors; scoped_refptr<ParsedCertificate> issuer_cert = ParsedCertificate::Create( - node->cert->derCert.data, node->cert->derCert.len, {}, &errors); + x509_util::CreateCryptoBuffer(node->cert->derCert.data, + node->cert->derCert.len), + {}, &errors); if (!issuer_cert) { // TODO(crbug.com/634443): return errors better. LOG(ERROR) << "Error parsing issuer certificate:\n"
diff --git a/net/cert/internal/cert_issuer_source_sync_unittest.h b/net/cert/internal/cert_issuer_source_sync_unittest.h index 6b36b2f..cf3eb426 100644 --- a/net/cert/internal/cert_issuer_source_sync_unittest.h +++ b/net/cert/internal/cert_issuer_source_sync_unittest.h
@@ -9,6 +9,7 @@ #include "net/cert/internal/cert_issuer_source.h" #include "net/cert/internal/test_helpers.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/boringssl/src/include/openssl/pool.h" namespace net { @@ -34,7 +35,10 @@ if (!r) return r; CertErrors errors; - *result = ParsedCertificate::Create(der, {}, &errors); + *result = ParsedCertificate::Create( + bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( + reinterpret_cast<const uint8_t*>(der.data()), der.size(), nullptr)), + {}, &errors); if (!*result) { return ::testing::AssertionFailure() << "ParsedCertificate::Create() failed:\n"
diff --git a/net/cert/internal/parse_certificate_fuzzer.cc b/net/cert/internal/parse_certificate_fuzzer.cc index 67ea6986..382df09 100644 --- a/net/cert/internal/parse_certificate_fuzzer.cc +++ b/net/cert/internal/parse_certificate_fuzzer.cc
@@ -8,11 +8,12 @@ #include "base/macros.h" #include "net/cert/internal/cert_errors.h" #include "net/cert/internal/parsed_certificate.h" +#include "net/cert/x509_util.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { net::CertErrors errors; - scoped_refptr<net::ParsedCertificate> cert = - net::ParsedCertificate::Create(data, size, {}, &errors); + scoped_refptr<net::ParsedCertificate> cert = net::ParsedCertificate::Create( + net::x509_util::CreateCryptoBuffer(data, size), {}, &errors); // TODO(crbug.com/634443): Ensure that !errors.empty() on parsing failure. return 0;
diff --git a/net/cert/internal/parsed_certificate.cc b/net/cert/internal/parsed_certificate.cc index 6c2676cd..0c655079 100644 --- a/net/cert/internal/parsed_certificate.cc +++ b/net/cert/internal/parsed_certificate.cc
@@ -8,6 +8,7 @@ #include "net/cert/internal/signature_algorithm.h" #include "net/cert/internal/verify_name_match.h" #include "net/der/parser.h" +#include "third_party/boringssl/src/include/openssl/pool.h" namespace net { @@ -24,73 +25,51 @@ ParsedCertificate::ParsedCertificate() {} ParsedCertificate::~ParsedCertificate() {} +// static scoped_refptr<ParsedCertificate> ParsedCertificate::Create( - const uint8_t* data, - size_t length, + bssl::UniquePtr<CRYPTO_BUFFER> cert_data, const ParseCertificateOptions& options, CertErrors* errors) { - return CreateInternal(data, length, DataSource::INTERNAL_COPY, options, - errors); + return CreateInternal(std::move(cert_data), der::Input(), options, errors); } -scoped_refptr<ParsedCertificate> ParsedCertificate::Create( - const base::StringPiece& data, - const ParseCertificateOptions& options, - CertErrors* errors) { - return ParsedCertificate::Create( - reinterpret_cast<const uint8_t*>(data.data()), data.size(), options, - errors); -} - +// static bool ParsedCertificate::CreateAndAddToVector( - const uint8_t* data, - size_t length, + bssl::UniquePtr<CRYPTO_BUFFER> cert_data, const ParseCertificateOptions& options, - ParsedCertificateList* chain, + std::vector<scoped_refptr<net::ParsedCertificate>>* chain, CertErrors* errors) { - scoped_refptr<ParsedCertificate> cert(Create(data, length, options, errors)); + scoped_refptr<ParsedCertificate> cert( + Create(std::move(cert_data), options, errors)); if (!cert) return false; chain->push_back(std::move(cert)); return true; } -bool ParsedCertificate::CreateAndAddToVector( - const base::StringPiece& data, - const ParseCertificateOptions& options, - ParsedCertificateList* chain, - CertErrors* errors) { - return CreateAndAddToVector(reinterpret_cast<const uint8_t*>(data.data()), - data.size(), options, chain, errors); -} - +// static scoped_refptr<ParsedCertificate> ParsedCertificate::CreateWithoutCopyingUnsafe( const uint8_t* data, size_t length, const ParseCertificateOptions& options, CertErrors* errors) { - return CreateInternal(data, length, DataSource::EXTERNAL_REFERENCE, options, - errors); + return CreateInternal(nullptr, der::Input(data, length), options, errors); } +// static scoped_refptr<ParsedCertificate> ParsedCertificate::CreateInternal( - const uint8_t* data, - size_t length, - DataSource source, + bssl::UniquePtr<CRYPTO_BUFFER> backing_data, + der::Input static_data, const ParseCertificateOptions& options, CertErrors* errors) { // TODO(crbug.com/634443): Add errors scoped_refptr<ParsedCertificate> result(new ParsedCertificate); - - switch (source) { - case DataSource::INTERNAL_COPY: - result->cert_data_.assign(data, data + length); - result->cert_ = - der::Input(result->cert_data_.data(), result->cert_data_.size()); - break; - case DataSource::EXTERNAL_REFERENCE: - result->cert_ = der::Input(data, length); - break; + if (backing_data) { + result->cert_data_ = std::move(backing_data); + result->cert_ = der::Input(CRYPTO_BUFFER_data(result->cert_data_.get()), + CRYPTO_BUFFER_len(result->cert_data_.get())); + } else { + result->cert_ = static_data; } if (!ParseCertificate(result->cert_, &result->tbs_certificate_tlv_,
diff --git a/net/cert/internal/parsed_certificate.h b/net/cert/internal/parsed_certificate.h index 0b7c89f..06bd3789 100644 --- a/net/cert/internal/parsed_certificate.h +++ b/net/cert/internal/parsed_certificate.h
@@ -13,6 +13,7 @@ #include "net/base/net_export.h" #include "net/cert/internal/parse_certificate.h" #include "net/der/input.h" +#include "third_party/boringssl/src/include/openssl/base.h" namespace net { @@ -40,21 +41,10 @@ // Creates a ParsedCertificate given a DER-encoded Certificate. Returns // nullptr on failure. Failure will occur if the standard certificate fields // and supported extensions cannot be parsed. - // - // The provided certificate data is copied, so |data| needn't remain valid - // after this call. - // // On either success or failure, if |errors| is non-null it may have error // information added to it. static scoped_refptr<ParsedCertificate> Create( - const uint8_t* data, - size_t length, - const ParseCertificateOptions& options, - CertErrors* errors); - - // Overload that takes a StringPiece. - static scoped_refptr<ParsedCertificate> Create( - const base::StringPiece& data, + bssl::UniquePtr<CRYPTO_BUFFER> cert_data, const ParseCertificateOptions& options, CertErrors* errors); @@ -65,15 +55,7 @@ // On either success or failure, if |errors| is non-null it may have error // information added to it. static bool CreateAndAddToVector( - const uint8_t* data, - size_t length, - const ParseCertificateOptions& options, - std::vector<scoped_refptr<net::ParsedCertificate>>* chain, - CertErrors* errors); - - // Overload that takes a StringPiece. - static bool CreateAndAddToVector( - const base::StringPiece& data, + bssl::UniquePtr<CRYPTO_BUFFER> cert_data, const ParseCertificateOptions& options, std::vector<scoped_refptr<net::ParsedCertificate>>* chain, CertErrors* errors); @@ -208,50 +190,23 @@ } private: - // The certificate data for may either be owned internally (INTERNAL_COPY) or - // owned externally (EXTERNAL_REFERENCE). When it is owned internally the data - // is held by |cert_data_| - enum class DataSource { - INTERNAL_COPY, - EXTERNAL_REFERENCE, - }; - friend class base::RefCountedThreadSafe<ParsedCertificate>; ParsedCertificate(); ~ParsedCertificate(); + // Creates a ParsedCertificate. If |backing_data| is non-null, the + // certificate's DER-encoded data will be referenced from here. Otherwise the + // certificate's data will be |static_data|, and the pointer MUST remain + // valid and its data unmodified for the entirety of the program. static scoped_refptr<ParsedCertificate> CreateInternal( - const uint8_t* data, - size_t length, - DataSource source, + bssl::UniquePtr<CRYPTO_BUFFER> backing_data, + der::Input static_data, const ParseCertificateOptions& options, CertErrors* errors); - // These private overloads should not be used, and have no definition. - // - // They are here to prevent incorrectly passing a const char* - // in place of a base::StringPiece (thanks to StringPiece implicit - // ctor on const char*). - // - // Accidentally inflating a const char* (without length) to a - // StringPiece would be a bug. - static scoped_refptr<ParsedCertificate> Create( - const char* invalid_data, - const ParseCertificateOptions& options, - CertErrors* errors); - static bool CreateAndAddToVector( - const char* data, - const ParseCertificateOptions& options, - std::vector<scoped_refptr<net::ParsedCertificate>>* chain, - CertErrors* errors); - - // The backing store for the certificate data. This is only applicable when - // the ParsedCertificate was initialized using DataSource::INTERNAL_COPY. - std::vector<uint8_t> cert_data_; - - // Note that the backing data for |cert_| (and its may come either from - // |cert_data_| or some external buffer (depending on how the - // ParsedCertificate was created). + // The backing store for the certificate data. May be null if created by + // CreateWithoutCopyingUnsafe. + bssl::UniquePtr<CRYPTO_BUFFER> cert_data_; // Points to the raw certificate DER. der::Input cert_;
diff --git a/net/cert/internal/parsed_certificate_unittest.cc b/net/cert/internal/parsed_certificate_unittest.cc index ab1d4a0..5212caab 100644 --- a/net/cert/internal/parsed_certificate_unittest.cc +++ b/net/cert/internal/parsed_certificate_unittest.cc
@@ -9,6 +9,7 @@ #include "net/cert/internal/test_helpers.h" #include "net/der/input.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/boringssl/src/include/openssl/pool.h" namespace net { @@ -35,8 +36,10 @@ EXPECT_TRUE(ReadTestDataFromPemFile(test_file_path, mappings)); CertErrors errors; - scoped_refptr<ParsedCertificate> cert = - ParsedCertificate::Create(data, {}, &errors); + scoped_refptr<ParsedCertificate> cert = ParsedCertificate::Create( + bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( + reinterpret_cast<const uint8_t*>(data.data()), data.size(), nullptr)), + {}, &errors); EXPECT_EQ(expected_errors, errors.ToDebugString()) << "Test file: " << test_file_path;
diff --git a/net/cert/internal/path_builder_pkits_unittest.cc b/net/cert/internal/path_builder_pkits_unittest.cc index b362519..2d16ee9b 100644 --- a/net/cert/internal/path_builder_pkits_unittest.cc +++ b/net/cert/internal/path_builder_pkits_unittest.cc
@@ -12,6 +12,7 @@ #include "net/cert/internal/trust_store_in_memory.h" #include "net/cert/internal/verify_certificate_chain.h" #include "net/der/input.h" +#include "third_party/boringssl/src/include/openssl/pool.h" // Disable tests that require DSA signatures (DSA signatures are intentionally // unsupported). Custom versions of the DSA tests are defined below which expect @@ -59,7 +60,11 @@ ParsedCertificateList certs; for (const std::string& der : cert_ders) { CertErrors errors; - if (!ParsedCertificate::CreateAndAddToVector(der, {}, &certs, &errors)) { + if (!ParsedCertificate::CreateAndAddToVector( + bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( + reinterpret_cast<const uint8_t*>(der.data()), der.size(), + nullptr)), + {}, &certs, &errors)) { ADD_FAILURE() << "ParseCertificate::CreateAndAddToVector() failed:\n" << errors.ToDebugString(); return false;
diff --git a/net/cert/internal/path_builder_unittest.cc b/net/cert/internal/path_builder_unittest.cc index 35fe154..212b8de3 100644 --- a/net/cert/internal/path_builder_unittest.cc +++ b/net/cert/internal/path_builder_unittest.cc
@@ -20,6 +20,7 @@ #include "net/test/test_certificate_data.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/boringssl/src/include/openssl/pool.h" namespace net { @@ -101,7 +102,10 @@ if (!r) return r; CertErrors errors; - *result = ParsedCertificate::Create(der, {}, &errors); + *result = ParsedCertificate::Create( + bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( + reinterpret_cast<const uint8_t*>(der.data()), der.size(), nullptr)), + {}, &errors); if (!*result) { return ::testing::AssertionFailure() << "ParseCertificate::Create() failed:\n" @@ -785,8 +789,11 @@ TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediates) { // Create a separate copy of oldintermediate. scoped_refptr<ParsedCertificate> oldintermediate_dupe( - ParsedCertificate::Create(oldintermediate_->der_cert().AsStringPiece(), - {}, nullptr)); + ParsedCertificate::Create( + bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( + oldintermediate_->der_cert().UnsafeData(), + oldintermediate_->der_cert().Length(), nullptr)), + {}, nullptr)); // Only newroot is a trusted root. TrustStoreInMemory trust_store; @@ -847,7 +854,10 @@ TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediateAndRoot) { // Create a separate copy of newroot. scoped_refptr<ParsedCertificate> newroot_dupe(ParsedCertificate::Create( - newroot_->der_cert().AsStringPiece(), {}, nullptr)); + bssl::UniquePtr<CRYPTO_BUFFER>( + CRYPTO_BUFFER_new(newroot_->der_cert().UnsafeData(), + newroot_->der_cert().Length(), nullptr)), + {}, nullptr)); // Only newroot is a trusted root. TrustStoreInMemory trust_store; @@ -1034,8 +1044,11 @@ } scoped_refptr<ParsedCertificate> oldintermediate_dupe( - ParsedCertificate::Create(oldintermediate_->der_cert().AsStringPiece(), - {}, nullptr)); + ParsedCertificate::Create( + bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( + oldintermediate_->der_cert().UnsafeData(), + oldintermediate_->der_cert().Length(), nullptr)), + {}, nullptr)); EXPECT_CALL(*target_issuers_req, GetNext(_)) // First async batch: return oldintermediate_.
diff --git a/net/cert/internal/test_helpers.cc b/net/cert/internal/test_helpers.cc index 2b87e49..24d4f329 100644 --- a/net/cert/internal/test_helpers.cc +++ b/net/cert/internal/test_helpers.cc
@@ -12,6 +12,7 @@ #include "net/cert/pem_tokenizer.h" #include "net/der/parser.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/boringssl/src/include/openssl/pool.h" namespace net { @@ -142,15 +143,21 @@ if (block_type == kCertificateHeader) { CertErrors errors; - ASSERT_TRUE(net::ParsedCertificate::CreateAndAddToVector(block_data, {}, - chain, &errors)) + ASSERT_TRUE(net::ParsedCertificate::CreateAndAddToVector( + bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( + reinterpret_cast<const uint8_t*>(block_data.data()), + block_data.size(), nullptr)), + {}, chain, &errors)) << errors.ToDebugString(); } else if (block_type == kTrustAnchorUnconstrained || block_type == kTrustAnchorConstrained) { ASSERT_FALSE(*trust_anchor) << "Duplicate trust anchor"; CertErrors errors; - scoped_refptr<ParsedCertificate> root = - net::ParsedCertificate::Create(block_data, {}, &errors); + scoped_refptr<ParsedCertificate> root = net::ParsedCertificate::Create( + bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( + reinterpret_cast<const uint8_t*>(block_data.data()), + block_data.size(), nullptr)), + {}, &errors); ASSERT_TRUE(root) << errors.ToDebugString(); *trust_anchor = block_type == kTrustAnchorUnconstrained
diff --git a/net/cert/internal/trust_store_nss.cc b/net/cert/internal/trust_store_nss.cc index dd214dc..0a67939c 100644 --- a/net/cert/internal/trust_store_nss.cc +++ b/net/cert/internal/trust_store_nss.cc
@@ -11,6 +11,7 @@ #include "crypto/nss_util.h" #include "net/cert/internal/cert_errors.h" #include "net/cert/internal/parsed_certificate.h" +#include "net/cert/x509_util.h" // TODO(mattm): structure so that supporting ChromeOS multi-profile stuff is // doable (Have a TrustStoreChromeOS which uses net::NSSProfileFilterChromeOS, @@ -56,7 +57,9 @@ CertErrors errors; scoped_refptr<ParsedCertificate> anchor_cert = ParsedCertificate::Create( - node->cert->derCert.data, node->cert->derCert.len, {}, &errors); + x509_util::CreateCryptoBuffer(node->cert->derCert.data, + node->cert->derCert.len), + {}, &errors); if (!anchor_cert) { // TODO(crbug.com/634443): return errors better. LOG(ERROR) << "Error parsing issuer certificate:\n"
diff --git a/net/cert/internal/verify_certificate_chain_pkits_unittest.cc b/net/cert/internal/verify_certificate_chain_pkits_unittest.cc index 6e2209a..52a5ff88 100644 --- a/net/cert/internal/verify_certificate_chain_pkits_unittest.cc +++ b/net/cert/internal/verify_certificate_chain_pkits_unittest.cc
@@ -8,6 +8,7 @@ #include "net/cert/internal/signature_policy.h" #include "net/cert/internal/trust_store.h" #include "net/der/input.h" +#include "third_party/boringssl/src/include/openssl/pool.h" // Disable tests that require DSA signatures (DSA signatures are intentionally // unsupported). Custom versions of the DSA tests are defined below which expect @@ -58,8 +59,11 @@ std::vector<scoped_refptr<net::ParsedCertificate>> input_chain; CertErrors errors; for (auto i = cert_ders.rbegin(); i != cert_ders.rend(); ++i) { - if (!net::ParsedCertificate::CreateAndAddToVector(*i, {}, &input_chain, - &errors)) { + if (!net::ParsedCertificate::CreateAndAddToVector( + bssl::UniquePtr<CRYPTO_BUFFER>( + CRYPTO_BUFFER_new(reinterpret_cast<const uint8_t*>(i->data()), + i->size(), nullptr)), + {}, &input_chain, &errors)) { ADD_FAILURE() << "Cert failed to parse:\n" << errors.ToDebugString(); return false; }
diff --git a/net/cert/x509_util.h b/net/cert/x509_util.h index 63b0c298..1773fdd 100644 --- a/net/cert/x509_util.h +++ b/net/cert/x509_util.h
@@ -15,7 +15,7 @@ #include "base/strings/string_piece.h" #include "base/time/time.h" #include "net/base/net_export.h" -#include "third_party/boringssl/src/include/openssl/base.h" +#include "third_party/boringssl/src/include/openssl/pool.h" namespace crypto { class RSAPrivateKey; @@ -111,6 +111,20 @@ // Returns a CRYPTO_BUFFER_POOL for deduplicating certificates. NET_EXPORT CRYPTO_BUFFER_POOL* GetBufferPool(); +// Creates a CRYPTO_BUFFER in the same pool returned by GetBufferPool. +NET_EXPORT bssl::UniquePtr<CRYPTO_BUFFER> CreateCryptoBuffer( + const uint8_t* data, + size_t length); + +// Creates a CRYPTO_BUFFER in the same pool returned by GetBufferPool. +NET_EXPORT bssl::UniquePtr<CRYPTO_BUFFER> CreateCryptoBuffer( + const base::StringPiece& data); + +// Overload with no definition, to disallow creating a CRYPTO_BUFFER from a +// char* due to StringPiece implicit ctor. +NET_EXPORT bssl::UniquePtr<CRYPTO_BUFFER> CreateCryptoBuffer( + const char* invalid_data); + } // namespace x509_util } // namespace net
diff --git a/net/cert/x509_util_openssl.cc b/net/cert/x509_util_openssl.cc index 4e79ad8a..d36fd5e4 100644 --- a/net/cert/x509_util_openssl.cc +++ b/net/cert/x509_util_openssl.cc
@@ -365,6 +365,19 @@ return g_buffer_pool_singleton.Get().pool(); } +bssl::UniquePtr<CRYPTO_BUFFER> CreateCryptoBuffer(const uint8_t* data, + size_t length) { + return bssl::UniquePtr<CRYPTO_BUFFER>( + CRYPTO_BUFFER_new(data, length, GetBufferPool())); +} + +bssl::UniquePtr<CRYPTO_BUFFER> CreateCryptoBuffer( + const base::StringPiece& data) { + return bssl::UniquePtr<CRYPTO_BUFFER>( + CRYPTO_BUFFER_new(reinterpret_cast<const uint8_t*>(data.data()), + data.size(), GetBufferPool())); +} + } // namespace x509_util } // namespace net
diff --git a/net/quic/core/quic_framer.cc b/net/quic/core/quic_framer.cc index 2c9f632..5d8936a 100644 --- a/net/quic/core/quic_framer.cc +++ b/net/quic/core/quic_framer.cc
@@ -138,6 +138,7 @@ largest_packet_number_(0), last_path_id_(kInvalidPathId), last_serialized_connection_id_(0), + last_version_tag_(0), supported_versions_(supported_versions), decrypter_level_(ENCRYPTION_NONE), alternative_decrypter_level_(ENCRYPTION_NONE), @@ -696,7 +697,9 @@ if (header.public_header.version_flag) { DCHECK_EQ(Perspective::IS_CLIENT, perspective_); QuicTag tag = QuicVersionToQuicTag(quic_version_); - writer->WriteUInt32(tag); + if (!writer->WriteUInt32(tag)) { + return false; + } QUIC_DVLOG(1) << ENDPOINT << "version = " << quic_version_ << ", tag = '" << QuicTagToString(tag) << "'"; }
diff --git a/net/socket/tcp_socket_posix.cc b/net/socket/tcp_socket_posix.cc index 438d5aa..a37d83b 100644 --- a/net/socket/tcp_socket_posix.cc +++ b/net/socket/tcp_socket_posix.cc
@@ -14,6 +14,8 @@ #include "base/logging.h" #include "base/metrics/histogram_macros.h" #include "base/posix/eintr_wrapper.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_piece.h" #include "base/task_scheduler/post_task.h" #include "base/time/time.h" #include "net/base/address_list.h" @@ -23,6 +25,7 @@ #include "net/base/network_activity_monitor.h" #include "net/base/network_change_notifier.h" #include "net/base/sockaddr_storage.h" +#include "net/http/http_util.h" #include "net/log/net_log.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_source.h" @@ -92,12 +95,15 @@ &system_supports_tcp_fastopen)) { return false; } - // The read from /proc should return '1' if TCP FastOpen is enabled in the OS. - if (system_supports_tcp_fastopen.empty() || - (system_supports_tcp_fastopen[0] != '1')) { - return false; - } - return true; + // The read value from /proc will be set in its least significant bit if + // TCP FastOpen is enabled. + int read_int = 0; + base::StringToInt( + HttpUtil::TrimLWS(base::StringPiece(system_supports_tcp_fastopen)), + &read_int); + if ((read_int & 0x1) == 1) + return true; + return false; } void RegisterTCPFastOpenIntentAndSupport(bool user_enabled,
diff --git a/net/tools/cert_verify_tool/verify_using_path_builder.cc b/net/tools/cert_verify_tool/verify_using_path_builder.cc index b94a08e..60576cd 100644 --- a/net/tools/cert_verify_tool/verify_using_path_builder.cc +++ b/net/tools/cert_verify_tool/verify_using_path_builder.cc
@@ -21,6 +21,7 @@ #include "net/cert/internal/signature_policy.h" #include "net/cert/internal/trust_store_collection.h" #include "net/cert/internal/trust_store_in_memory.h" +#include "net/cert/x509_util.h" #include "net/cert_net/cert_net_fetcher_impl.h" #include "net/tools/cert_verify_tool/cert_verify_tool_util.h" #include "net/url_request/url_request_context.h" @@ -158,8 +159,8 @@ scoped_refptr<net::ParsedCertificate> ParseCertificate(const CertInput& input) { net::CertErrors errors; - scoped_refptr<net::ParsedCertificate> cert = - net::ParsedCertificate::Create(input.der_cert, {}, &errors); + scoped_refptr<net::ParsedCertificate> cert = net::ParsedCertificate::Create( + net::x509_util::CreateCryptoBuffer(input.der_cert), {}, &errors); if (!cert) { PrintCertError("ERROR: ParsedCertificate failed:", input); std::cout << errors.ToDebugString() << "\n";
diff --git a/printing/OWNERS b/printing/OWNERS index 7487e48a..db535f8 100644 --- a/printing/OWNERS +++ b/printing/OWNERS
@@ -7,3 +7,5 @@ per-file printing_context_android*=avayvod@chromium.org per-file printing_context_android*=dgn@chromium.org + +# COMPONENT: Internals>Printing
diff --git a/services/ui/ws/window_manager_window_tree_factory.cc b/services/ui/ws/window_manager_window_tree_factory.cc index 9b8a55e..26be4b7 100644 --- a/services/ui/ws/window_manager_window_tree_factory.cc +++ b/services/ui/ws/window_manager_window_tree_factory.cc
@@ -16,11 +16,8 @@ WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set, const UserId& user_id, mojo::InterfaceRequest<mojom::WindowManagerWindowTreeFactory> request) - : window_manager_window_tree_factory_set_( - window_manager_window_tree_factory_set), - user_id_(user_id), - binding_(this), - window_tree_(nullptr) { + : WindowManagerWindowTreeFactory(window_manager_window_tree_factory_set, + user_id) { if (request.is_pending()) binding_.Bind(std::move(request)); }
diff --git a/skia/ext/skia_utils_mac.h b/skia/ext/skia_utils_mac.h index 8519cba..fda4ee98 100644 --- a/skia/ext/skia_utils_mac.h +++ b/skia/ext/skia_utils_mac.h
@@ -14,7 +14,6 @@ struct SkIRect; struct SkRect; -class SkCanvas; class SkMatrix; #ifdef __LP64__ typedef CGSize NSSize; @@ -93,48 +92,6 @@ // TODO(thakis): Remove this -- http://crbug.com/69432 SK_API NSImage* SkBitmapToNSImage(const SkBitmap& icon); -// Converts a SkCanvas temporarily to a CGContext -class SK_API SkiaBitLocker { - public: - /** - User clip rect is an *additional* clip to be applied in addition to the - current state of the canvas, in *local* rather than device coordinates. - If no additional clipping is desired, pass in - SkIRect::MakeSize(canvas->getBaseLayerSize()) transformed by the inverse - CTM. - */ - SkiaBitLocker(SkCanvas* canvas, - const SkIRect& userClipRect, - SkScalar bitmapScaleFactor = 1); - ~SkiaBitLocker(); - CGContextRef cgContext(); - bool hasEmptyClipRegion() const; - - private: - void releaseIfNeeded(); - SkIRect computeDirtyRect(); - - SkCanvas* canvas_; - - CGContextRef cgContext_; - // offscreen_ is only valid if useDeviceBits_ is false - SkBitmap offscreen_; - SkIPoint bitmapOffset_; - SkScalar bitmapScaleFactor_; - - // True if we are drawing to |canvas_|'s backing store directly. - // Otherwise, the bits in |bitmap_| are our allocation and need to - // be copied over to |canvas_|. - bool useDeviceBits_; - - // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating - // a non-NULL CGContext (it is invalid to use a NULL CGContext), and will not - // be copied to |canvas_|. This will happen if |canvas_|'s clip region is - // empty. - bool bitmapIsDummy_; -}; - - } // namespace skia #endif // SKIA_EXT_SKIA_UTILS_MAC_H_
diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm index 1b0a2fef..a8518885 100644 --- a/skia/ext/skia_utils_mac.mm +++ b/skia/ext/skia_utils_mac.mm
@@ -241,126 +241,4 @@ return SkBitmapToNSImageWithColorSpace(skiaBitmap, colorSpace.get()); } -SkiaBitLocker::SkiaBitLocker(SkCanvas* canvas, - const SkIRect& userClipRect, - SkScalar bitmapScaleFactor) - : canvas_(canvas), - cgContext_(0), - bitmapScaleFactor_(bitmapScaleFactor), - useDeviceBits_(false), - bitmapIsDummy_(false) { - canvas_->save(); - canvas_->clipRect(SkRect::MakeFromIRect(userClipRect)); -} - -SkiaBitLocker::~SkiaBitLocker() { - releaseIfNeeded(); - canvas_->restore(); -} - -SkIRect SkiaBitLocker::computeDirtyRect() { - // If the user specified a clip region, assume that it was tight and that the - // dirty rect is approximately the whole bitmap. - return SkIRect::MakeWH(offscreen_.width(), offscreen_.height()); -} - -// This must be called to balance calls to cgContext -void SkiaBitLocker::releaseIfNeeded() { - if (!cgContext_) - return; - if (!useDeviceBits_ && !bitmapIsDummy_) { - // Find the bits that were drawn to. - SkIRect bounds = computeDirtyRect(); - SkBitmap subset; - if (!offscreen_.extractSubset(&subset, bounds)) { - return; - } - subset.setImmutable(); // Prevents a defensive copy inside Skia. - canvas_->save(); - canvas_->setMatrix(SkMatrix::I()); // Reset back to device space. - canvas_->translate(bounds.x() + bitmapOffset_.x(), - bounds.y() + bitmapOffset_.y()); - canvas_->scale(1.f / bitmapScaleFactor_, 1.f / bitmapScaleFactor_); - canvas_->drawBitmap(subset, 0, 0); - canvas_->restore(); - } - CGContextRelease(cgContext_); - cgContext_ = 0; - useDeviceBits_ = false; - bitmapIsDummy_ = false; -} - -CGContextRef SkiaBitLocker::cgContext() { - releaseIfNeeded(); // This flushes any prior bitmap use - - SkIRect clip_bounds; - if (!canvas_->getDeviceClipBounds(&clip_bounds)) { - // If the clip is empty, then there is nothing to draw. The caller may - // attempt to draw (to-be-clipped) results, so ensure there is a dummy - // non-NULL CGContext to use. - bitmapIsDummy_ = true; - clip_bounds = SkIRect::MakeXYWH(0, 0, 1, 1); - } - - // remember the top/left, in case we need to compose this later - bitmapOffset_.set(clip_bounds.x(), clip_bounds.y()); - - // Now make clip_bounds be relative to the current layer/device - if (!bitmapIsDummy_) { - canvas_->temporary_internal_describeTopLayer(nullptr, &clip_bounds); - } - - SkPixmap devicePixels; - skia::GetWritablePixels(canvas_, &devicePixels); - - // Only draw directly if we have pixels, and we're only rect-clipped. - // If not, we allocate an offscreen and draw into that, relying on the - // compositing step to apply skia's clip. - useDeviceBits_ = devicePixels.addr() && - canvas_->isClipRect() && - !bitmapIsDummy_; - base::ScopedCFTypeRef<CGColorSpaceRef> colorSpace( - CGColorSpaceCreateDeviceRGB()); - - int displayHeight; - if (useDeviceBits_) { - SkPixmap subset; - bool result = devicePixels.extractSubset(&subset, clip_bounds); - DCHECK(result); - if (!result) - return 0; - displayHeight = subset.height(); - cgContext_ = CGBitmapContextCreate(subset.writable_addr(), subset.width(), - subset.height(), 8, subset.rowBytes(), colorSpace, - kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); - } else { - bool result = offscreen_.tryAllocN32Pixels( - SkScalarCeilToInt(bitmapScaleFactor_ * clip_bounds.width()), - SkScalarCeilToInt(bitmapScaleFactor_ * clip_bounds.height())); - DCHECK(result); - if (!result) - return 0; - offscreen_.eraseColor(0); - displayHeight = offscreen_.height(); - cgContext_ = CGBitmapContextCreate(offscreen_.getPixels(), - offscreen_.width(), offscreen_.height(), 8, offscreen_.rowBytes(), - colorSpace, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); - } - DCHECK(cgContext_); - - SkMatrix matrix = canvas_->getTotalMatrix(); - matrix.postTranslate(-SkIntToScalar(bitmapOffset_.x()), - -SkIntToScalar(bitmapOffset_.y())); - matrix.postScale(bitmapScaleFactor_, -bitmapScaleFactor_); - matrix.postTranslate(0, SkIntToScalar(displayHeight)); - - CGContextConcatCTM(cgContext_, SkMatrixToCGAffineTransform(matrix)); - - return cgContext_; -} - -bool SkiaBitLocker::hasEmptyClipRegion() const { - return canvas_->isClipEmpty(); -} - } // namespace skia
diff --git a/skia/ext/skia_utils_mac_unittest.mm b/skia/ext/skia_utils_mac_unittest.mm index 64f2049..f5906be9 100644 --- a/skia/ext/skia_utils_mac_unittest.mm +++ b/skia/ext/skia_utils_mac_unittest.mm
@@ -9,7 +9,6 @@ #include "base/mac/foundation_util.h" #include "base/mac/scoped_nsobject.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" namespace { @@ -28,14 +27,6 @@ // Checks that the given bitmap is red. void TestSkBitmap(const SkBitmap& bitmap); - enum BitLockerTest { - TestIdentity = 0, - TestTranslate = 1, - TestClip = 2, - TestXClip = TestTranslate | TestClip, - }; - void RunBitLockerTest(BitLockerTest test); - // If not red, is blue. // If not tfbit (twenty-four-bit), is 444. void ShapeHelper(int width, int height, bool isred, bool tfbit); @@ -130,45 +121,6 @@ EXPECT_EQ(255u, SkColorGetA(color)); } -void SkiaUtilsMacTest::RunBitLockerTest(BitLockerTest test) { - const unsigned width = 2; - const unsigned height = 2; - const unsigned storageSize = width * height; - const unsigned original[] = {0xFF333333, 0xFF666666, 0xFF999999, 0xFFCCCCCC}; - EXPECT_EQ(storageSize, sizeof(original) / sizeof(original[0])); - unsigned bits[storageSize]; - memcpy(bits, original, sizeof(original)); - SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); - SkBitmap bitmap; - bitmap.installPixels(info, bits, info.minRowBytes()); - - SkCanvas canvas(bitmap); - if (test & TestTranslate) - canvas.translate(width / 2, 0); - if (test & TestClip) { - SkRect clipRect = {0, height / 2, width, height}; - canvas.clipRect(clipRect); - } - { - SkIRect clip = SkIRect::MakeSize(canvas.getBaseLayerSize()). - makeOffset((test & TestTranslate) ? - (static_cast<int>(width)) / 2 : 0, 0); - skia::SkiaBitLocker bitLocker(&canvas, clip); - CGContextRef cgContext = bitLocker.cgContext(); - CGColorRef testColor = CGColorGetConstantColor(kCGColorWhite); - CGContextSetFillColorWithColor(cgContext, testColor); - CGRect cgRect = {{0, 0}, {width, height}}; - CGContextFillRect(cgContext, cgRect); - } - const unsigned results[][storageSize] = { - {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}, // identity - {0xFF333333, 0xFFFFFFFF, 0xFF999999, 0xFFFFFFFF}, // translate - {0xFF333333, 0xFF666666, 0xFFFFFFFF, 0xFFFFFFFF}, // clip - {0xFF333333, 0xFF666666, 0xFF999999, 0xFFFFFFFF} // translate | clip - }; - for (unsigned index = 0; index < storageSize; index++) - EXPECT_EQ(results[test][index], bits[index]); -} - void SkiaUtilsMacTest::ShapeHelper(int width, int height, bool isred, bool tfbit) { SkBitmap thing(CreateSkBitmap(width, height, isred, tfbit)); @@ -224,21 +176,5 @@ TestSkBitmap(bitmap); } -TEST_F(SkiaUtilsMacTest, BitLocker_Identity) { - RunBitLockerTest(SkiaUtilsMacTest::TestIdentity); -} - -TEST_F(SkiaUtilsMacTest, BitLocker_Translate) { - RunBitLockerTest(SkiaUtilsMacTest::TestTranslate); -} - -TEST_F(SkiaUtilsMacTest, BitLocker_Clip) { - RunBitLockerTest(SkiaUtilsMacTest::TestClip); -} - -TEST_F(SkiaUtilsMacTest, BitLocker_XClip) { - RunBitLockerTest(SkiaUtilsMacTest::TestXClip); -} - } // namespace
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index bafac36..ef9d3eb0 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -769,8 +769,6 @@ crbug.com/538697 [ Win7 Debug ] virtual/threaded/printing/webgl-oversized-printing.html [ Failure Crash ] crbug.com/538697 [ Win7 Debug ] printing/webgl-oversized-printing.html [ Failure Crash ] -crbug.com/617152 external/wpt/mediacapture-streams/GUM-impossible-constraint.https.html [ Skip ] - crbug.com/281504 fast/canvas/canvas-large-pattern.html [ Failure ] crbug.com/281504 virtual/display_list_2d_canvas/fast/canvas/canvas-large-pattern.html [ Failure ] crbug.com/281504 virtual/gpu/fast/canvas/canvas-large-pattern.html [ Failure ] @@ -967,19 +965,7 @@ Bug(github) external/wpt/uievents/keyboard/key-manual.css [ Skip ] Bug(github) external/wpt/uievents/keyboard/key-manual.js [ Skip ] -crbug.com/387740 external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https.html [ Skip ] -crbug.com/387740 external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https.html [ Skip ] -crbug.com/387740 external/wpt/mediacapture-streams/MediaStreamTrack-end.https.html [ Skip ] -crbug.com/387740 external/wpt/mediacapture-streams/MediaStreamTrack-init.https.html [ Skip ] -crbug.com/387740 external/wpt/mediacapture-streams/MediaStream-audio-only.https.html [ Skip ] -crbug.com/387740 external/wpt/mediacapture-streams/MediaStream-finished-add.https.html [ Skip ] -crbug.com/387740 external/wpt/mediacapture-streams/MediaStream-idl.https.html [ Skip ] -crbug.com/387740 external/wpt/mediacapture-streams/MediaStream-removetrack.https.html [ Skip ] - -crbug.com/412381 external/wpt/mediacapture-streams/GUM-empty-option-param.https.html [ Failure ] -crbug.com/412381 external/wpt/mediacapture-streams/GUM-unknownkey-option-param.https.html [ Failure ] -crbug.com/412381 external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none.https.html [ Pass Timeout Failure ] - +crbug.com/688613 external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https.html [ Skip ] crbug.com/542660 fast/css/absolute-inline-alignment-2.html [ Failure ] @@ -1763,9 +1749,6 @@ crbug.com/599115 virtual/mojo-loading/http/tests/preload/document-write [ Failure ] crbug.com/599115 virtual/mojo-loading/http/tests/preload/document-write/document_write_no_preload.html [ Pass ] -crbug.com/600261 external/wpt/mediacapture-streams/GUM-deny.https.html [ Failure ] -crbug.com/600261 external/wpt/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html [ Failure ] - crbug.com/605525 [ Win ] http/tests/xmlhttprequest/redirect-cross-origin-post.html [ Failure Pass ] crbug.com/600248 external/wpt/web-animations/interfaces/Animation/constructor.html [ Failure Timeout ] @@ -1882,8 +1865,6 @@ crbug.com/692105 external/wpt/streams/writable-streams/floating-point-total-queue-size.html [ Skip ] crbug.com/692105 external/wpt/streams/writable-streams/floating-point-total-queue-size.serviceworker.https.html [ Skip ] crbug.com/692105 external/wpt/streams/writable-streams/floating-point-total-queue-size.sharedworker.html [ Skip ] -crbug.com/692105 external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance.html [ Skip ] -crbug.com/692105 external/wpt/web-animations/timing-model/time-transformations/transformed-progress.html [ Skip ] # These policies are not implemented yet. crbug.com/627968 external/wpt/referrer-policy/origin-when-cross-origin/http-rp/same-origin/ [ Skip ] @@ -2163,6 +2144,16 @@ crbug.com/626703 [ Win ] external/csswg-test/css-flexbox-1/flex-minimum-width-flex-items-001.xht [ Failure ] crbug.com/626703 [ Win ] external/csswg-test/css-flexbox-1/flex-minimum-width-flex-items-003.xht [ Failure ] crbug.com/626703 [ Win ] external/csswg-test/css-flexbox-1/flexbox_flex-natural-mixed-basis-auto.html [ Failure ] +crbug.com/626703 external/csswg-test/css-display-3/display-contents-alignment-001.html [ Failure ] +crbug.com/626703 external/csswg-test/css-display-3/display-contents-alignment-002.html [ Failure ] +crbug.com/626703 external/csswg-test/css-rhythm-1/line-height-step-basic-001.html [ Failure ] +crbug.com/626703 external/csswg-test/css-rhythm-1/line-height-step-boundary-001.html [ Failure ] +crbug.com/626703 external/csswg-test/css-rhythm-1/line-height-step-ruby-001.html [ Failure ] +crbug.com/626703 external/csswg-test/css-rhythm-1/line-height-step-valign-001.html [ Failure ] +crbug.com/626703 external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-001.html [ Failure ] +crbug.com/626703 external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-ruby-001.html [ Failure ] +crbug.com/626703 external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-005.xht [ Failure ] +crbug.com/626703 external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-004.xht [ Failure ] crbug.com/626703 external/csswg-test/css-writing-modes-3/sizing-orthog-prct-htb-in-vrl-002.xht [ Failure ] crbug.com/626703 external/csswg-test/css-writing-modes-3/sizing-orthog-htb-in-vrl-020.xht [ Failure ] crbug.com/626703 external/csswg-test/css-writing-modes-3/sizing-orthog-vlr-in-htb-020.xht [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-001-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-001-expected.html new file mode 100644 index 0000000..595aa7f7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-001-expected.html
@@ -0,0 +1,23 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Test Reference</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:ecobos@igalia.com"> +<style> + .container { + display: flex; + width: 300px; + height: 300px; + align-items: center; + border: 2px solid purple; + } + .container > div { + width: 100px; + height: 100px; + background: blue; + align-self: auto; + } +</style> +<p>Test passes if there's a blue square vertically centered inside the box.</p> +<div class="container"> + <div></div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-001.html new file mode 100644 index 0000000..6a6bf8c7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-001.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Test: flex container align-items is used for flex item regardless of intermediate display: contents ancestors</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:ecobos@igalia.com"> +<link rel="help" href="https://drafts.csswg.org/css-display-3/#valdef-display-contents"> +<link rel="help" href="https://drafts.csswg.org/css-align/#align-items-property"> +<link rel="match" href="display-contents-alignment-001-ref.html"> +<style> + .container { + display: flex; + width: 300px; + height: 300px; + align-items: center; + border: 2px solid purple; + } + .contents { + display: contents; + align-items: flex-start; + } + .contents > div { + width: 100px; + height: 100px; + background: blue; + align-self: auto; + } +</style> +<p>Test passes if there's a blue square vertically centered inside the box.</p> +<div class="container"> + <div class="contents"> + <div></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-002-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-002-expected.html new file mode 100644 index 0000000..f58ccf0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-002-expected.html
@@ -0,0 +1,23 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Test Reference</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:ecobos@igalia.com"> +<style> + .container { + display: grid; + width: 300px; + height: 300px; + justify-items: center; + border: 2px solid purple; + } + .container > div { + width: 100px; + height: 100px; + background: blue; + justify-self: auto; + } +</style> +<p>Test passes if there's a blue square horizontally centered inside the box.</p> +<div class="container"> + <div></div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-002.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-002.html new file mode 100644 index 0000000..d8fa0d9e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-alignment-002.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Test: grid container justify-items is used for grid item regardless of intermediate display: contents ancestors</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:ecobos@igalia.com"> +<link rel="help" href="https://drafts.csswg.org/css-display-3/#valdef-display-contents"> +<link rel="help" href="https://drafts.csswg.org/css-align/#justify-items-property"> +<link rel="match" href="display-contents-alignment-002-ref.html"> +<style> + .container { + display: grid; + width: 300px; + height: 300px; + justify-items: center; + border: 2px solid purple; + } + .contents { + display: contents; + justify-items: start; + } + .contents > div { + width: 100px; + height: 100px; + background: blue; + justify-self: auto; + } +</style> +<p>Test passes if there's a blue square horizontally centered inside the box.</p> +<div class="container"> + <div class="contents"> + <div></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-computed-style-expected.txt b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-computed-style-expected.txt new file mode 100644 index 0000000..4597b288 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-computed-style-expected.txt
@@ -0,0 +1,8 @@ +This is a testharness.js-based test. +PASS Serialization of computed style value for display:contents +PASS display:contents element as inherit parent - explicit inheritance +PASS display:contents element as inherit parent - implicit inheritance +FAIL Resolved value should be computed value, not used value, for display:contents assert_equals: expected "auto" but got "588px" +PASS display:contents is blockified for root elements +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-computed-style.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-computed-style.html index 5f232f2..e7c428b 100644 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-computed-style.html +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-display-3/display-contents-computed-style.html
@@ -15,11 +15,7 @@ #t3 .contents { color: green } - #t4 { display: flex; align-items: center } - #t4 .contents { align-items: baseline } - #t4 span { align-self: auto } - - #t5 { + #t4 { width: auto; height: 50%; margin-left: 25%; @@ -42,7 +38,7 @@ <span></span> </div> </div> -<div id="t5" class="contents"></div> +<div id="t4" class="contents"></div> <script> test(function(){ assert_equals(getComputedStyle(document.querySelector("#t1")).display, "contents"); @@ -57,11 +53,7 @@ }, "display:contents element as inherit parent - implicit inheritance"); test(function(){ - assert_equals(getComputedStyle(document.querySelector("#t4 span")).alignSelf, "baseline"); - }, "align-self:auto resolution for flex item inside display:contents"); - - test(function(){ - var computed = getComputedStyle(document.querySelector("#t5")); + var computed = getComputedStyle(document.querySelector("#t4")); assert_equals(computed.width, "auto"); assert_equals(computed.height, "50%"); assert_equals(computed.marginLeft, "25%");
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/100x100-green.png b/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/100x100-green.png index 3883542..0dcda08 100644 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/100x100-green.png +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/100x100-green.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/100x50-green.png b/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/100x50-green.png index 9dae3116..67f3eaa6 100644 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/100x50-green.png +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/100x50-green.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/200x200-green.png b/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/200x200-green.png index 7a47c0e..e8b591f 100644 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/200x200-green.png +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/200x200-green.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/50x100-green.png b/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/50x100-green.png index 2854698..c10c9a7f 100644 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/50x100-green.png +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-grid-1/grid-items/support/50x100-green.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-center-001-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-basic-001-expected.html similarity index 83% rename from third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-center-001-expected.html rename to third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-basic-001-expected.html index 7ab6834..e277021 100644 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-center-001-expected.html +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-basic-001-expected.html
@@ -1,5 +1,5 @@ <!DOCTYPE html> -<title>CSS Snap Size: snap-height center</title> +<title>CSS Rhythmic Sizing: line-height-step basic layout reference</title> <link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> <style> div { @@ -11,10 +11,6 @@ vertical-align: top; width: 5em; } -.test { - line-height: 40px; - snap-height: 60px; -} .ref { line-height: 60px; }
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-center-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-basic-001.html similarity index 63% rename from third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-center-001.html rename to third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-basic-001.html index ce647ad..19727e3 100644 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-center-001.html +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-basic-001.html
@@ -1,9 +1,9 @@ <!DOCTYPE html> -<title>CSS Snap Size: snap-height center</title> +<title>CSS Rhythmic Sizing: line-height-step basic layout</title> <link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> -<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#snap-height"> -<link rel="match" href="reference/snap-height-center-001.html"> -<meta name="assert" content="This test asserts the snap-height property rounds up line box height."> +<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#line-height-step"> +<link rel="match" href="reference/line-height-step-basic-001.html"> +<meta name="assert" content="This test asserts the line-height-step property rounds up line box height."> <meta name="flags" content="ahem"> <style> div { @@ -17,7 +17,7 @@ } .test { line-height: 40px; - snap-height: 60px; + line-height-step: 60px; } .ref { line-height: 60px;
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-boundary-001-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-boundary-001-expected.html new file mode 100644 index 0000000..17e7515 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-boundary-001-expected.html
@@ -0,0 +1,31 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step boundary test</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<style> +div { + font-family: Ahem; + font-size: 30px; +} +.test, .ref { + display: inline-block; + vertical-align: top; + width: 5em; +} +</style> +<p class="instructions">Test passes if left and right are the same. +<div class="ref"> + <div style="line-height: 40px">XXXXX</div> + <div style="line-height: 40px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 120px">XXXXX</div> +</div> +<div class="ref"> + <div style="line-height: 40px">XXXXX</div> + <div style="line-height: 40px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 120px">XXXXX</div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-boundary-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-boundary-001.html new file mode 100644 index 0000000..50681bf --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-boundary-001.html
@@ -0,0 +1,38 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step boundary test</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#line-height-step"> +<link rel="match" href="reference/line-height-step-boundary-001.html"> +<meta name="assert" content="This test asserts the line-height-step property rounds up line box height."> +<meta name="flags" content="ahem"> +<style> +div { + font-family: Ahem; + font-size: 30px; +} +.test, .ref { + display: inline-block; + vertical-align: top; + width: 5em; +} +.test { + line-height-step: 40px; +} +</style> +<p class="instructions">Test passes if left and right are the same. +<div class="ref"> + <div style="line-height: 40px">XXXXX</div> + <div style="line-height: 40px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 120px">XXXXX</div> +</div> +<div class="test"> + <div style="line-height: 39px">XXXXX</div> + <div style="line-height: 40px">XXXXX</div> + <div style="line-height: 41px">XXXXX</div> + <div style="line-height: 79px">XXXXX</div> + <div style="line-height: 80px">XXXXX</div> + <div style="line-height: 81px">XXXXX</div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-dynamic-001-expected.txt b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-dynamic-001-expected.txt new file mode 100644 index 0000000..0cd352295 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-dynamic-001-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL Height must change when line-height-step changes assert_not_equals: got disallowed value 28 +PASS Height must not change after relayout +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-dynamic-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-dynamic-001.html new file mode 100644 index 0000000..d6f7bd9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-dynamic-001.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step dynamic change</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#line-height-step"> +<meta name="assert" content="This test asserts changing the line-height-step property takes effects."> +<meta name="flags" content="dom"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> +div { + font-size: 20px; + line-height: 1; +} +</style> +<div id="log"></div> +<div id="target">X</div> +<div id="next">X</div> +<script> +runTests(); +function runTests() { + var before = next.offsetTop; + target.style.lineHeightStep = "40px"; + var after = next.offsetTop; + forceRelayout(document.documentElement); + var afterRelayout = next.offsetTop; + + test(function () { + assert_not_equals(after, before); + }, "Height must change when line-height-step changes"); + test(function () { + assert_equals(after, afterRelayout); + }, "Height must not change after relayout"); +} + +function forceRelayout(element) { + var saved = element.style.display; + element.style.display = "none"; + element.offsetTop; + element.style.display = saved; + element.offsetTop; +} +</script>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-parsing-001-expected.txt b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-parsing-001-expected.txt new file mode 100644 index 0000000..2c8f95e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-parsing-001-expected.txt
@@ -0,0 +1,12 @@ +This is a testharness.js-based test. +FAIL initial value should be '0px' assert_equals: expected (string) "0px" but got (undefined) undefined +FAIL 'line-height-step: 20px' should compute to '20px' assert_equals: expected (string) "20px" but got (undefined) undefined +FAIL line-height-step should inherit assert_equals: expected (string) "20px" but got (undefined) undefined +FAIL 'line-height-step: initial' should compute to '0px' assert_equals: expected (string) "0px" but got (undefined) undefined +FAIL 'line-height-step: 40px' should compute to '40px' assert_equals: expected (string) "40px" but got (undefined) undefined +FAIL '0' should be a valid length assert_equals: expected (string) "0px" but got (undefined) undefined +FAIL Interger should be invalid assert_equals: expected (string) "20px" but got (undefined) undefined +FAIL Negative length should be invalid assert_equals: expected (string) "20px" but got (undefined) undefined +FAIL Computed value should be the absolute length Cannot read property 'slice' of undefined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-parsing-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-parsing-001.html new file mode 100644 index 0000000..3febf057 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-parsing-001.html
@@ -0,0 +1,38 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: parsing line-height-step</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#line-height-step"> +<meta name="assert" content="This test asserts the parsing and getComputedStyle works correctly for the line-height-step property."> +<meta name="flags" content="dom"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<div title="initial value should be '0px'" data-expected="0px"></div> + +<div style="line-height-step: 20px" data-expected="20px"> + <div title="line-height-step should inherit" data-expected="20px"></div> + <div style="line-height-step: initial" data-expected="0px"></div> + + <div style="line-height-step: 40px" data-expected="40px"></div> + + <div title="'0' should be a valid length" style="line-height-step: 0" data-expected="0px"></div> + + <div title="Interger should be invalid" style="line-height-step: 1" data-expected="20px"></div> + <div title="Negative length should be invalid" style="line-height-step: -1px" data-expected="20px"></div> +</div> + +<div id="pt" style="line-height-step: 40pt"></div> + +<script> +Array.prototype.forEach.call(document.querySelectorAll("[data-expected]"), function (element) { + var expected = element.dataset.expected; + test(function () { + var actual = getComputedStyle(element).lineHeightStep; + assert_equals(actual, expected); + }, element.title || "'" + element.getAttribute("style") + "' should compute to '" + expected + "'"); +}); + +test(function () { + assert_equals(getComputedStyle(document.getElementById("pt")).lineHeightStep.slice(-2), "px"); +}, "Computed value should be the absolute length"); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-ruby-001-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-ruby-001-expected.html new file mode 100644 index 0000000..a358c1d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-ruby-001-expected.html
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step and ruby</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<style> +div { + font-family: Ahem; + font-size: 40px; +} +.test, .ref { + display: inline-block; + vertical-align: top; + width: 5em; +} +.ref { + line-height: 120px; +} +</style> +<body> +<p class="instructions">Test passes if left and right are the same. +<div class="ref"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> +</div> +<div class="ref"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> +</div> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-ruby-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-ruby-001.html new file mode 100644 index 0000000..f79f13b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-ruby-001.html
@@ -0,0 +1,34 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step and ruby</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#line-height-step"> +<link rel="match" href="reference/line-height-step-ruby-001.html"> +<meta name="assert" content="This test asserts the line-height-step property and ruby."> +<meta name="flags" content="ahem"> +<style> +div { + font-family: Ahem; + font-size: 40px; +} +.test, .ref { + display: inline-block; + vertical-align: top; + width: 5em; +} +.test { + line-height: 40px; + line-height-step: 120px; +} +.ref { + line-height: 120px; +} +</style> +<body> +<p class="instructions">Test passes if left and right are the same. +<div class="ref"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> +</div> +<div class="test"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> +</div> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-valign-001-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-valign-001-expected.html new file mode 100644 index 0000000..4925fbc0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-valign-001-expected.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step vertical-align test</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<style> +div { + font-family: Ahem; + font-size: 40px; +} +.ref { + line-height: 1; +} +.adjuster { + line-height: 80px; + color: transparent; +} +.top { + vertical-align: top; +} +.text-top { + vertical-align: text-top; +} +.text-bottom { + vertical-align: text-bottom; +} +.bottom { + vertical-align: bottom; +} +</style> +<p class="instructions">Test passes if two lines are the same. +<div class="ref"> + <div>XX<span class="top">X</span><span class="text-top">X</span><span class="text-bottom">X</span><span class="bottom">X</span><span class="adjuster">X</span></div> +</div> +<div class="ref"> + <div>XX<span class="top">X</span><span class="text-top">X</span><span class="text-bottom">X</span><span class="bottom">X</span><span class="adjuster">X</span></div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-valign-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-valign-001.html new file mode 100644 index 0000000..032b3c0a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-valign-001.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step vertical-align test</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#line-height-step"> +<link rel="match" href="reference/line-height-step-valign-001.html"> +<meta name="assert" content="This test asserts the vertical-align property with the line-height-step property."> +<meta name="flags" content="ahem"> +<style> +div { + font-family: Ahem; + font-size: 40px; +} +.test { + line-height-step: 80px; +} +.ref { + line-height: 1; +} +.adjuster { + line-height: 80px; + color: transparent; +} +.top { + vertical-align: top; +} +.text-top { + vertical-align: text-top; +} +.text-bottom { + vertical-align: text-bottom; +} +.bottom { + vertical-align: bottom; +} +</style> +<p class="instructions">Test passes if two lines are the same. +<div class="ref"> + <div>XX<span class="top">X</span><span class="text-top">X</span><span class="text-bottom">X</span><span class="bottom">X</span><span class="adjuster">X</span></div> +</div> +<div class="test"> + <div>XX<span class="top">X</span><span class="text-top">X</span><span class="text-bottom">X</span><span class="bottom">X</span></div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-001-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-001-expected.html new file mode 100644 index 0000000..a358c1d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-001-expected.html
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step and ruby</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<style> +div { + font-family: Ahem; + font-size: 40px; +} +.test, .ref { + display: inline-block; + vertical-align: top; + width: 5em; +} +.ref { + line-height: 120px; +} +</style> +<body> +<p class="instructions">Test passes if left and right are the same. +<div class="ref"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> +</div> +<div class="ref"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> +</div> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-001.html new file mode 100644 index 0000000..4d07493 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-001.html
@@ -0,0 +1,37 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step in vertical-rl</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#line-height-step"> +<link rel="match" href="reference/line-height-step-ruby-001.html"> +<meta name="assert" content="This test asserts the line-height-step property in vertical-rl writing mode."> +<meta name="flags" content="ahem"> +<style> +.container { + font-family: Ahem; + font-size: 40px; + writing-mode: vertical-rl; + width: 5em; +} +.test, .ref { + display: inline-block; + vertical-align: top; +} +.test { + line-height: 40px; + line-height-step: 120px; +} +.ref { + line-height: 120px; +} +</style> +<body> +<p class="instructions">Test passes if top and bottom are the same. +<div class="container"> + <div class="ref"> + <div>XXXXX</div> + </div> + <div class="test"> + <div>XXXXX</div> + </div> +</div> +</body> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-ruby-001-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-ruby-001-expected.html new file mode 100644 index 0000000..a358c1d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-ruby-001-expected.html
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step and ruby</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<style> +div { + font-family: Ahem; + font-size: 40px; +} +.test, .ref { + display: inline-block; + vertical-align: top; + width: 5em; +} +.ref { + line-height: 120px; +} +</style> +<body> +<p class="instructions">Test passes if left and right are the same. +<div class="ref"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> +</div> +<div class="ref"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> +</div> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-ruby-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-ruby-001.html new file mode 100644 index 0000000..1c633339 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/line-height-step-writing-mode-vrl-ruby-001.html
@@ -0,0 +1,37 @@ +<!DOCTYPE html> +<title>CSS Rhythmic Sizing: line-height-step with ruby in vertical-rl</title> +<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> +<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#line-height-step"> +<link rel="match" href="reference/line-height-step-ruby-001.html"> +<meta name="assert" content="This test asserts the line-height-step property with ruby in vertical-rl writing mode."> +<meta name="flags" content="ahem"> +<style> +.container { + font-family: Ahem; + font-size: 40px; + writing-mode: vertical-rl; + width: 5em; +} +.test, .ref { + display: inline-block; + vertical-align: top; +} +.test { + line-height: 40px; + line-height-step: 120px; +} +.ref { + line-height: 120px; +} +</style> +<body> +<p class="instructions">Test passes if top and bottom are the same. +<div class="container"> + <div class="ref"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> + </div> + <div class="test"> + <div>X<ruby>XX<rt>XX</rt></ruby>X</div> + </div> +</div> +</body> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-baseline-001-expected.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-baseline-001-expected.html deleted file mode 100644 index 0bb3137..0000000 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-baseline-001-expected.html +++ /dev/null
@@ -1,43 +0,0 @@ -<!DOCTYPE html> -<title>CSS Snap Size: snap-height baseline</title> -<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> -<style> -div { - font-family: Ahem; - font-size: 40px; - line-height: 40px; -} -.test, .ref { - display: inline-block; - vertical-align: top; - width: 5em; -} -.test { - snap-height: 64px 50; -} -.ref > div { - margin-bottom: 24px; -} -.transparent { - color: transparent; -} -</style> -<p class="instructions">Test passes if left and right are the same. -<div class="ref"> - <div>XXXXX</div> - <div>XXXXX</div> - <div>XXXXX</div> - <div>XXXXX</div> - <div class="transparent">X</div> - <div>X</div> - <div>X</div> -</div> -<div class="ref"> - <div>XXXXX</div> - <div>XXXXX</div> - <div>XXXXX</div> - <div>XXXXX</div> - <div class="transparent">X</div> - <div>X</div> - <div>X</div> -</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-baseline-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-baseline-001.html deleted file mode 100644 index fa40852..0000000 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-baseline-001.html +++ /dev/null
@@ -1,43 +0,0 @@ -<!DOCTYPE html> -<title>CSS Snap Size: snap-height baseline</title> -<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> -<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#snap-height"> -<link rel="match" href="reference/snap-height-baseline-001.html"> -<meta name="assert" content="This test asserts the snap-height property rounds up line box height and set the baseline position."> -<meta name="flags" content="ahem"> -<style> -div { - font-family: Ahem; - font-size: 40px; - line-height: 40px; -} -.test, .ref { - display: inline-block; - vertical-align: top; - width: 5em; -} -.test { - snap-height: 64px 50; -} -.ref > div { - margin-bottom: 24px; -} -.transparent { - color: transparent; -} -</style> -<p class="instructions">Test passes if left and right are the same. -<div class="ref"> - <div>XXXXX</div> - <div>XXXXX</div> - <div>XXXXX</div> - <div>XXXXX</div> - <div class="transparent">X</div> - <div>X</div> - <div>X</div> -</div> -<div class="test"> - <div>XXXXX</div> - <div>XXXXX XXXXX XXXXX</div> - <div><br>X<br>X</div> -</div>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-dynamic-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-dynamic-001.html deleted file mode 100644 index 3af90aed..0000000 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-dynamic-001.html +++ /dev/null
@@ -1,37 +0,0 @@ -<!DOCTYPE html> -<title>CSS Snap Size: snap-height dynamic change</title> -<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> -<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#snap-height"> -<meta name="assert" content="This test asserts changing the snap-height property takes effects."> -<meta name="flags" content="dom"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<style> -div { - font-size: 20px; - line-height: 1; -} -</style> -<div id="log"></div> -<div id="target">X</div> -<div id="next">X</div> -<script> -var before = next.offsetTop; -target.style.snapHeight = "40px"; -var after = next.offsetTop; -forceRelayout(document.documentElement); -var afterRelayout = next.offsetTop; - -test(function () { - assert_not_equals(after, before, "Height must change when snap-height changes"); - assert_equals(after, afterRelayout, "Height must not change after relayout"); -}); - -function forceRelayout(element) { - var saved = element.style.display; - element.style.display = "none"; - element.offsetTop; - element.style.display = saved; - element.offsetTop; -} -</script>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-parsing-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-parsing-001.html deleted file mode 100644 index b574de9..0000000 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-rhythm-1/snap-height-parsing-001.html +++ /dev/null
@@ -1,42 +0,0 @@ -<!DOCTYPE html> -<title>CSS Snap Size: parsing snap-height</title> -<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> -<link rel="help" href="https://drafts.csswg.org/css-rhythm-1/#snap-height"> -<meta name="assert" content="This test asserts the parsing and getComputedStyle works correctly for the snap-height property."> -<meta name="flags" content="dom"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> - -<div data-expected="0px" title="initial value"></div> - -<div style="snap-height: 20px 60" data-expected="20px 60"> - <div data-expected="20px 60" title="snap-height should inherit"></div> - <div style="snap-height: initial" data-expected="0px"></div> - <div style="snap-height: initial; snap-height: inherit" data-expected="20px 60"></div> - - <div style="snap-height: 40px" data-expected="40px"></div> - - <div style="snap-height: 0" data-expected="0px"></div> - - <div style="snap-height: 1" data-expected="20px 60"></div> - - <div style="snap-height: -1px" data-expected="20px 60"></div> - <div style="snap-height: 40px -1" data-expected="20px 60"></div> - <div style="snap-height: 40px 0" data-expected="20px 60"></div> - <div style="snap-height: 40px 101" data-expected="20px 60"></div> -</div> - -<div id="pt" style="snap-height: 40pt"></div> - -<script> -Array.prototype.forEach.call(document.querySelectorAll("[data-expected]"), function (element) { - test(function () { - var actual = getComputedStyle(element).snapHeight; - assert_equals(actual, element.dataset.expected); - }, element.title || element.getAttribute("style")); -}); - -test(function () { - assert_equals(getComputedStyle(document.getElementById("pt")).snapHeight.slice(-2), "px"); -}, "Computed value must be the absolute length"); -</script>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-003-expected.xht b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-003-expected.xht new file mode 100644 index 0000000..9fe444c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-003-expected.xht
@@ -0,0 +1,38 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + + <head> + + <title>CSS Reftest Reference</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + + <meta content="image" name="flags" /> + + <style type="text/css"><![CDATA[ + div + { + margin-left: 0.5em; + } + + img + { + vertical-align: top; + } + + img#green-square + { + position: relative; + left: 96px; /* 80px + p's margin-left (1em) */ + top: 160px; + } + ]]></style> + </head> + + <body> + + <div><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /><img id="green-square" src="support/swatch-green.png" width="80" height="80" alt="Image download support must be enabled" /></div> + + </body> +</html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-003.xht b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-003.xht new file mode 100644 index 0000000..481a0289 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-003.xht
@@ -0,0 +1,153 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + + <head> + + <title>CSS Writing Modes Test: non-replaced block in normal flow with 'direction: ltr' in vertical-lr (overconstrained)</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout" title="7.4 Flow-Relative Mappings" /> + <link rel="match" href="abs-pos-non-replaced-vlr-007-ref.xht" /> + + <meta name="flags" content="ahem image" /> + <meta name="assert" content="This test checks that when an inline dimension of a non-replaced block in normal flow is over-constrained, the inline-end margin is dropped and recalculated so that the equation involving inline-size is balanced; such equation takes under account the inline's direction (ltr or rtl). In this test, the inline-end margin (physical margin-bottom) is recalculated." /> + + <!-- + " + the margin that is dropped when a box’s inline dimension is over-constrained is the end margin as determined by the writing mode of the containing block. + " + 7.4 Flow-Relative Mappings + http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout + + " + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block + + If all of the above have a computed value other than 'auto', the values are said to be "over-constrained" and one of the used values will have to be different from its computed value. If the 'direction' property of the containing block has the value 'ltr', the specified value of 'margin-right' is ignored and the value is calculated so as to make the equality true. If the value of 'direction' is 'rtl', this happens to 'margin-left' instead. + " + CSS 2.1, section 10.3.3 Block-level, non-replaced elements in normal flow + http://www.w3.org/TR/CSS21/visudet.html#blockwidth + --> + + <meta name="DC.date.created" content="2015-10-16T09:54:03+11:00" scheme="W3CDTF" /> + <meta name="DC.date.modified" content="2017-02-18T09:54:03+11:00" scheme="W3CDTF" /> + + <style type="text/css"><![CDATA[ + html + { + writing-mode: vertical-lr; + } + + body#containing-block + { + background-image: url("support/bg-red-3col-3row-320x320.png"); + background-position: 198px 8px; + /* first value represents the horizontal position and the second represents the vertical position */ + + /* + 16px (p's margin-left) + + + 246px (img's width) + + + 16px (p's margin-right) + ======== + 278px + - + 80px (1 column of 80px) + ======== + 198px + */ + background-repeat: no-repeat; + direction: ltr; + height: 320px; + margin: 8px; + } + + p + { + margin-left: 16px; + margin-right: 16px; + } + + div + { + background-color: green; + margin-top: 160px; + border-top: green solid 20px; + padding-top: 20px; + height: 0px; + padding-bottom: 20px; + border-bottom: green solid 20px; + margin-bottom: -160px; + + margin-left: 96px; /* 80px + 16px necessary so that we can reuse an already created and available reference file */ + width: 80px; + } + +/* +" +Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes. +" +7.1 Principles of Layout in Vertical Writing Modes +http://www.w3.org/TR/css-writing-modes-3/#vertical-layout + +So here, *-top and *-bottom properties are input into the §10.3.3 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules. + +'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' = height of containing block + +So: + + 160px : margin-top + + + 20px : border-top-width + + + 20px : padding-top + + + 0px : height + + + 20px : padding-bottom + + + 20px : border-bottom-width + + + -160px : margin-bottom + ======================== + 80px : while the height of containing block of div is 320px + +So, here, the specified value of 'margin-bottom' is ignored and the value is calculated so as to make the equality true + + 160px : margin-top + + + 20px : border-top-width + + + 20px : padding-top + + + 0px : height + + + 20px : padding-bottom + + + 20px : border-bottom-width + + + (solve) : margin-bottom + ======================== + 320px : height of containing block + +And so computed margin-bottom value must be 80px . +*/ + + ]]></style> + + </head> + + <body id="containing-block"> + + <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p> + <!-- + The image says: + Test passes if there is a filled + green square and <strong>no red</strong>. + --> + + <div></div> + + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-005-expected.xht b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-005-expected.xht new file mode 100644 index 0000000..299aff3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-005-expected.xht
@@ -0,0 +1,38 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + + <head> + + <title>CSS Reftest Reference</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + + <meta content="image" name="flags" /> + + <style type="text/css"><![CDATA[ + div + { + margin-left: 0.5em; + } + + img + { + vertical-align: top; + } + + img#green-square + { + position: relative; + left: 96px; /* 80px + p's margin-left (1em) */ + top: 80px; + } + ]]></style> + </head> + + <body> + + <div><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /><img id="green-square" src="support/swatch-green.png" width="80" height="80" alt="Image download support must be enabled" /></div> + + </body> +</html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-005.xht b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-005.xht new file mode 100644 index 0000000..2754e24 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vlr-005.xht
@@ -0,0 +1,154 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + + <head> + + <title>CSS Writing Modes Test: non-replaced block in normal flow with 'direction: rtl' in vertical-lr (overconstrained)</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout" title="7.4 Flow-Relative Mappings" /> + <link rel="match" href="abs-pos-non-replaced-vlr-013-ref.xht" /> + + <meta name="flags" content="ahem image" /> + <meta name="assert" content="This test checks that when an inline dimension of a non-replaced block in normal flow is over-constrained, the inline-end margin is dropped and recalculated so that the equation involving inline-size is balanced; such equation takes under account the inline's direction (ltr or rtl). In this test, the inline-end margin (physical margin-top) is recalculated." /> + + <!-- + " + the margin that is dropped when a box’s inline dimension is over-constrained is the end margin as determined by the writing mode of the containing block. + " + 7.4 Flow-Relative Mappings + http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout + + " + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block + + If all of the above have a computed value other than 'auto', the values are said to be "over-constrained" and one of the used values will have to be different from its computed value. If the 'direction' property of the containing block has the value 'ltr', the specified value of 'margin-right' is ignored and the value is calculated so as to make the equality true. If the value of 'direction' is 'rtl', this happens to 'margin-left' instead. + " + CSS 2.1, section 10.3.3 Block-level, non-replaced elements in normal flow + http://www.w3.org/TR/CSS21/visudet.html#blockwidth + --> + + <meta name="DC.date.created" content="2015-10-16T09:54:03+11:00" scheme="W3CDTF" /> + <meta name="DC.date.modified" content="2017-02-18T09:54:03+11:00" scheme="W3CDTF" /> + + <style type="text/css"><![CDATA[ + html + { + writing-mode: vertical-lr; + } + + body#containing-block + { + background-image: url("support/bg-red-3col-2row-320x320.png"); + background-position: 198px 8px; + /* first value represents the horizontal position and the second represents the vertical position */ + + /* + 16px (p's margin-left) + + + 246px (img's width) + + + 16px (p's margin-right) + ======== + 278px + - + 80px (1 column of 80px) + ======== + 198px + */ + background-repeat: no-repeat; + direction: rtl; + height: 320px; + margin: 8px; + } + + p + { + direction: ltr; + margin-left: 16px; + margin-right: 16px; + } + + div + { + background-color: green; + margin-top: 160px; + border-top: green solid 20px; + padding-top: 20px; + height: 0px; + padding-bottom: 20px; + border-bottom: green solid 20px; + margin-bottom: 160px; + + margin-left: 96px; /* 80px + 16px necessary so that we can reuse an already created and available reference file */ + width: 80px; + } + +/* +" +Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes. +" +7.1 Principles of Layout in Vertical Writing Modes +http://www.w3.org/TR/css-writing-modes-3/#vertical-layout + +So here, *-top and *-bottom properties are input into the §10.3.3 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules. + +'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' = height of containing block + +So: + + 160px : margin-top + + + 20px : border-top-width + + + 20px : padding-top + + + 0px : height + + + 20px : padding-bottom + + + 20px : border-bottom-width + + + 160px : margin-bottom + ======================== + 400px : while the height of containing block of div is 320px + +So, here, the specified value of 'margin-top' is ignored and the value is calculated so as to make the equality true + + (solve) : margin-top + + + 20px : border-top-width + + + 20px : padding-top + + + 0px : height + + + 20px : padding-bottom + + + 20px : border-bottom-width + + + 160px : margin-bottom + ======================== + 320px : height of containing block + +And so computed margin-top value must be 80px . +*/ + + ]]></style> + + </head> + + <body id="containing-block"> + + <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p> + <!-- + The image says: + Test passes if there is a filled + green square and <strong>no red</strong>. + --> + + <div></div> + + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-002-expected.xht b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-002-expected.xht new file mode 100644 index 0000000..344ecda5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-002-expected.xht
@@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + + <head> + + <title>CSS Reftest Reference</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + + <meta content="image" name="flags" /> + + <style type="text/css"><![CDATA[ + body + { + direction: rtl; + } + + div + { + margin-right: 0.5em; + } + + img + { + vertical-align: top; + } + + img#green-square + { + position: relative; + right: 96px; /* 80px + p's margin-left (1em) */ + top: 160px; + } + ]]></style> + </head> + + <body> + + <div><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /><img id="green-square" src="support/swatch-green.png" width="80" height="80" alt="Image download support must be enabled" /></div> + + </body> +</html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-002.xht b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-002.xht new file mode 100644 index 0000000..ce43f2e3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-002.xht
@@ -0,0 +1,149 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + + <head> + + <title>CSS Writing Modes Test: non-replaced block in normal flow with 'direction: ltr' in vertical-rl (overconstrained)</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout" title="7.4 Flow-Relative Mappings" /> + <link rel="match" href="abs-pos-non-replaced-vrl-006-ref.xht" /> + + <meta name="flags" content="ahem image" /> + <meta name="assert" content="This test checks that when an inline dimension of a non-replaced block in normal flow is over-constrained, the inline-end margin is dropped and recalculated so that the equation involving inline-size is balanced; such equation takes under account the inline's direction (ltr or rtl). In this test, the inline-end margin (physical margin-bottom) is recalculated." /> + + <!-- + " + the margin that is dropped when a box’s inline dimension is over-constrained is the end margin as determined by the writing mode of the containing block. + " + 7.4 Flow-Relative Mappings + http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout + + " + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block + + If all of the above have a computed value other than 'auto', the values are said to be "over-constrained" and one of the used values will have to be different from its computed value. If the 'direction' property of the containing block has the value 'ltr', the specified value of 'margin-right' is ignored and the value is calculated so as to make the equality true. If the value of 'direction' is 'rtl', this happens to 'margin-left' instead. + " + CSS 2.1, section 10.3.3 Block-level, non-replaced elements in normal flow + http://www.w3.org/TR/CSS21/visudet.html#blockwidth + --> + + <meta name="DC.date.created" content="2015-10-16T09:54:03+11:00" scheme="W3CDTF" /> + <meta name="DC.date.modified" content="2017-02-18T09:54:03+11:00" scheme="W3CDTF" /> + + <style type="text/css"><![CDATA[ + html + { + writing-mode: vertical-rl; + } + + body#containing-block + { + background-image: url("support/bg-red-3col-3row-320x320.png"); + background-position: -152px 8px; + /* first value represents the horizontal position and the second represents the vertical position */ + + /* + 8px (body's margin-left) + - + 80px (4th column width) + - + 80px (3rd column width) + ======== + -152px + */ + background-repeat: no-repeat; + direction: ltr; + height: 320px; + margin: 8px; + } + + p + { + margin-left: 16px; + margin-right: 16px; + } + + div + { + background-color: green; + margin-top: 160px; + border-top: green solid 20px; + padding-top: 20px; + height: 0px; + padding-bottom: 20px; + border-bottom: green solid 20px; + margin-bottom: -160px; + + margin-right: 96px; /* 80px + 16px necessary so that we can reuse an already created and available reference file */ + width: 80px; + } + +/* +" +Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes. +" +7.1 Principles of Layout in Vertical Writing Modes +http://www.w3.org/TR/css-writing-modes-3/#vertical-layout + +So here, *-top and *-bottom properties are input into the §10.3.3 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules. + +'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' = height of containing block + +So: + + 160px : margin-top + + + 20px : border-top-width + + + 20px : padding-top + + + 0px : height + + + 20px : padding-bottom + + + 20px : border-bottom-width + + + -160px : margin-bottom + ======================== + 80px : while the height of containing block of div is 320px + +So, here, the specified value of 'margin-bottom' is ignored and the value is calculated so as to make the equality true + + 160px : margin-top + + + 20px : border-top-width + + + 20px : padding-top + + + 0px : height + + + 20px : padding-bottom + + + 20px : border-bottom-width + + + (solve) : margin-bottom + ======================== + 320px : height of containing block + +And so computed margin-bottom value must be 80px . +*/ + + ]]></style> + + </head> + + <body id="containing-block"> + + <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p> + <!-- + The image says: + Test passes if there is a filled + green square and <strong>no red</strong>. + --> + + <div></div> + + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-004-expected.xht b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-004-expected.xht new file mode 100644 index 0000000..a5b83e4b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-004-expected.xht
@@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + + <head> + + <title>CSS Reftest Reference</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + + <meta content="image" name="flags" /> + + <style type="text/css"><![CDATA[ + body + { + direction: rtl; + } + + div + { + margin-right: 0.5em; + } + + img + { + vertical-align: top; + } + + img#green-square + { + position: relative; + right: 96px; /* 80px + p's margin-left (1em) */ + top: 80px; + } + ]]></style> + </head> + + <body> + + <div><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /><img id="green-square" src="support/swatch-green.png" width="80" height="80" alt="Image download support must be enabled" /></div> + + </body> +</html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-004.xht b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-004.xht new file mode 100644 index 0000000..472405d1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/normal-flow-overconstrained-vrl-004.xht
@@ -0,0 +1,150 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + + <head> + + <title>CSS Writing Modes Test: non-replaced block in normal flow with 'direction: rtl' in vertical-rl (overconstrained)</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout" title="7.4 Flow-Relative Mappings" /> + <link rel="match" href="abs-pos-non-replaced-vrl-012-ref.xht" /> + + <meta name="flags" content="ahem image" /> + <meta name="assert" content="This test checks that when an inline dimension of a non-replaced block in normal flow is over-constrained, the inline-end margin is dropped and recalculated so that the equation involving inline-size is balanced; such equation takes under account the inline's direction (ltr or rtl). In this test, the inline-end margin (physical margin-top) is recalculated." /> + + <!-- + " + the margin that is dropped when a box’s inline dimension is over-constrained is the end margin as determined by the writing mode of the containing block. + " + 7.4 Flow-Relative Mappings + http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout + + " + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block + + If all of the above have a computed value other than 'auto', the values are said to be "over-constrained" and one of the used values will have to be different from its computed value. If the 'direction' property of the containing block has the value 'ltr', the specified value of 'margin-right' is ignored and the value is calculated so as to make the equality true. If the value of 'direction' is 'rtl', this happens to 'margin-left' instead. + " + CSS 2.1, section 10.3.3 Block-level, non-replaced elements in normal flow + http://www.w3.org/TR/CSS21/visudet.html#blockwidth + --> + + <meta name="DC.date.created" content="2015-10-16T09:54:03+11:00" scheme="W3CDTF" /> + <meta name="DC.date.modified" content="2017-02-18T09:54:03+11:00" scheme="W3CDTF" /> + + <style type="text/css"><![CDATA[ + html + { + writing-mode: vertical-rl; + } + + body#containing-block + { + background-image: url("support/bg-red-3col-2row-320x320.png"); + background-position: -152px 8px; + /* first value represents the horizontal position and the second represents the vertical position */ + + /* + 8px (body's margin-left) + - + 80px (4th column width) + - + 80px (3rd column width) + ======== + -152px + */ + background-repeat: no-repeat; + direction: rtl; + height: 320px; + margin: 8px; + } + + p + { + direction: ltr; + margin-left: 16px; + margin-right: 16px; + } + + div + { + background-color: green; + margin-top: 160px; + border-top: green solid 20px; + padding-top: 20px; + height: 0px; + padding-bottom: 20px; + border-bottom: green solid 20px; + margin-bottom: 160px; + + margin-right: 96px; /* 80px + 16px necessary so that we can reuse an already created and available reference file */ + width: 80px; + } + +/* +" +Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes. +" +7.1 Principles of Layout in Vertical Writing Modes +http://www.w3.org/TR/css-writing-modes-3/#vertical-layout + +So here, *-top and *-bottom properties are input into the §10.3.3 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules. + +'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' = height of containing block + +So: + + 160px : margin-top + + + 20px : border-top-width + + + 20px : padding-top + + + 0px : height + + + 20px : padding-bottom + + + 20px : border-bottom-width + + + 160px : margin-bottom + ======================== + 400px : while the height of containing block of div is 320px + +So, here, the specified value of 'margin-top' is ignored and the value is calculated so as to make the equality true + + (solve) : margin-top + + + 20px : border-top-width + + + 20px : padding-top + + + 0px : height + + + 20px : padding-bottom + + + 20px : border-bottom-width + + + 160px : margin-bottom + ======================== + 320px : height of containing block + +And so computed margin-top value must be 80px . +*/ + + ]]></style> + + </head> + + <body id="containing-block"> + + <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p> + <!-- + The image says: + Test passes if there is a filled + green square and <strong>no red</strong>. + --> + + <div></div> + + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/support/mplus-1p-regular.ttf b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/support/mplus-1p-regular.ttf new file mode 100644 index 0000000..d7adacb --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/support/mplus-1p-regular.ttf Binary files differ
diff --git a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/text-combine-upright-value-all-001.html b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/text-combine-upright-value-all-001.html index 31378a2..cd6f35c 100644 --- a/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/text-combine-upright-value-all-001.html +++ b/third_party/WebKit/LayoutTests/external/csswg-test/css-writing-modes-3/text-combine-upright-value-all-001.html
@@ -7,7 +7,7 @@ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#text-combine-upright"> <link rel="match" href="reference/text-combine-upright-value-single-character.html"> <meta name="assert" content="'text-combine-upright: all' rotates the composition even if tate-chu-yoko"> -<meta name="flags" content="font"> +<meta name="flags" content=""> <style> @font-face { font-family: tcu-font;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json b/third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json index c4464d8..878d5a0d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json
@@ -13,6 +13,18 @@ {} ] ], + "fullscreen/api/document-exit-fullscreen-nested-in-iframe-manual.html": [ + [ + "/fullscreen/api/document-exit-fullscreen-nested-in-iframe-manual.html", + {} + ] + ], + "fullscreen/api/document-exit-fullscreen-nested-manual.html": [ + [ + "/fullscreen/api/document-exit-fullscreen-nested-manual.html", + {} + ] + ], "fullscreen/api/document-exit-fullscreen-timing-manual.html": [ [ "/fullscreen/api/document-exit-fullscreen-timing-manual.html", @@ -313,6 +325,12 @@ {} ] ], + "mediacapture-streams/MediaStreamTrack-end-manual.html": [ + [ + "/mediacapture-streams/MediaStreamTrack-end-manual.html", + {} + ] + ], "pointerevents/compat/pointerevent_touch-action_two-finger_interaction-manual.html": [ [ "/pointerevents/compat/pointerevent_touch-action_two-finger_interaction-manual.html", @@ -18444,6 +18462,51 @@ {} ] ], + "mediacapture-streams/GUM-deny.https-expected.txt": [ + [ + {} + ] + ], + "mediacapture-streams/GUM-empty-option-param.https-expected.txt": [ + [ + {} + ] + ], + "mediacapture-streams/GUM-impossible-constraint.https-expected.txt": [ + [ + {} + ] + ], + "mediacapture-streams/GUM-unknownkey-option-param.https-expected.txt": [ + [ + {} + ] + ], + "mediacapture-streams/MediaStream-MediaElement-preload-none.https-expected.txt": [ + [ + {} + ] + ], + "mediacapture-streams/MediaStream-MediaElement-srcObject.https-expected.txt": [ + [ + {} + ] + ], + "mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https-expected.txt": [ + [ + {} + ] + ], + "mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https-expected.txt": [ + [ + {} + ] + ], + "mediacapture-streams/MediaStreamTrack-init.https-expected.txt": [ + [ + {} + ] + ], "mediasession/README.md": [ [ {} @@ -40016,12 +40079,6 @@ {} ] ], - "mediacapture-streams/MediaStreamTrack-end.https.html": [ - [ - "/mediacapture-streams/MediaStreamTrack-end.https.html", - {} - ] - ], "mediacapture-streams/MediaStreamTrack-id.https.html": [ [ "/mediacapture-streams/MediaStreamTrack-id.https.html", @@ -54766,7 +54823,7 @@ "support" ], "./MANIFEST.json": [ - "9308ccf7a833b8f021128cebbb59c78a5b03a9ae", + "49ed1806559e344b58eda2479a32992e41b5ecdd", "support" ], "./README.md": [ @@ -61393,6 +61450,14 @@ "673d72414fab3dbb677d21a05008d9014daf71bf", "manual" ], + "fullscreen/api/document-exit-fullscreen-nested-in-iframe-manual.html": [ + "521f776f725c48e6f38bd8af3e6bff498c8ea604", + "manual" + ], + "fullscreen/api/document-exit-fullscreen-nested-manual.html": [ + "5ddaf5fd8c2aef02fc4cefffa80a569e513a5491", + "manual" + ], "fullscreen/api/document-exit-fullscreen-timing-manual-expected.txt": [ "bb2508e35e8e52593e6fc4282f17c186f31e6bd3", "support" @@ -73909,14 +73974,26 @@ "6f4e3b2b4fdb287f99935193f273cb21becb9669", "testharness" ], + "mediacapture-streams/GUM-deny.https-expected.txt": [ + "a139d610439c4e0bb551e8b045841b33d6301126", + "support" + ], "mediacapture-streams/GUM-deny.https.html": [ "58581b53ff1a1edd5144c428145d668b073ef22f", "testharness" ], + "mediacapture-streams/GUM-empty-option-param.https-expected.txt": [ + "8f79868c0b4c44940c4cc094ba09dd30d0b6db64", + "support" + ], "mediacapture-streams/GUM-empty-option-param.https.html": [ "64d32a60ba62577a02f7314db5c1e43d3b0d51a9", "testharness" ], + "mediacapture-streams/GUM-impossible-constraint.https-expected.txt": [ + "83ef33025b6b7776852d8501718b670185056542", + "support" + ], "mediacapture-streams/GUM-impossible-constraint.https.html": [ "d0f93cff7289917b298a33691204509188bb633d", "testharness" @@ -73929,6 +74006,10 @@ "46175d553affeaa8c801359261816430f8b1fdb8", "testharness" ], + "mediacapture-streams/GUM-unknownkey-option-param.https-expected.txt": [ + "9a5065e1618f5d521471588f2c663964fcc4eb7c", + "support" + ], "mediacapture-streams/GUM-unknownkey-option-param.https.html": [ "bfd825c8fb46797d043d57d70689a766fa557bd3", "testharness" @@ -73941,10 +74022,18 @@ "a515deeec87c394b4a826b538df6dd0baa05cae6", "testharness" ], + "mediacapture-streams/MediaStream-MediaElement-preload-none.https-expected.txt": [ + "14e91f187214e8302a40719cb4ef2f69e1b1f59d", + "support" + ], "mediacapture-streams/MediaStream-MediaElement-preload-none.https.html": [ - "f80c766d154b39a83b9a09b5a1c099ddb7336351", + "0f2bbd7581f2f51376b7fada199b4d436f411dba", "testharness" ], + "mediacapture-streams/MediaStream-MediaElement-srcObject.https-expected.txt": [ + "06ea90d42bbf5737624f3582a8726301e938540b", + "support" + ], "mediacapture-streams/MediaStream-MediaElement-srcObject.https.html": [ "f90dade04a03631f9c56333f621fd6379eb48998", "testharness" @@ -73981,22 +74070,34 @@ "5f3e3390b52c567894cbcdf610489fc5b17ec94d", "testharness" ], + "mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https-expected.txt": [ + "da39a3ee5e6b4b0d3255bfef95601890afd80709", + "support" + ], "mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https.html": [ "48620661c2947245554e227d559d551a93787ae2", "testharness" ], + "mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https-expected.txt": [ + "4034d28ea06d606101c2f0be58bcc312075da025", + "support" + ], "mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https.html": [ "ff30dfac08aae859ad469c15fd7e5469b830d3a9", "testharness" ], - "mediacapture-streams/MediaStreamTrack-end.https.html": [ + "mediacapture-streams/MediaStreamTrack-end-manual.html": [ "e5550adb1a9ce03ba672271aa1cdcec7ffde27d6", - "testharness" + "manual" ], "mediacapture-streams/MediaStreamTrack-id.https.html": [ "ea67395aec0f0c619ba7b94eb4bd26b317a945d3", "testharness" ], + "mediacapture-streams/MediaStreamTrack-init.https-expected.txt": [ + "502d913f8ca1178e71eec066f3761a726607b93e", + "support" + ], "mediacapture-streams/MediaStreamTrack-init.https.html": [ "5cbc929d8add4eea27950f9b193001566d838f9e", "testharness"
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-nested-in-iframe-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-nested-in-iframe-manual.html new file mode 100644 index 0000000..11e6a6a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-nested-in-iframe-manual.html
@@ -0,0 +1,40 @@ +<!DOCTYPE html> +<title>Document#exitFullscreen() for nested fullscreen inside an iframe</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../trusted-click.js"></script> +<iframe allowfullscreen></iframe> +<script> +window.t = async_test(); +t.step(() => { + const iframe = document.querySelector("iframe"); + iframe.srcdoc = "<div><div></div></div>"; + iframe.onload = t.step_func(() => { + const doc = iframe.contentDocument; + const outer = doc.querySelector("div"); + const inner = outer.firstChild; + + // First request fullscreen for the outer element. + trusted_request(t, outer); + doc.onfullscreenchange = t.step_func(() => { + assert_equals(document.fullscreenElement, iframe); + assert_equals(doc.fullscreenElement, outer); + + // Then request fullscreen for the inner element. + trusted_request(t, inner); + doc.onfullscreenchange = t.step_func(() => { + assert_equals(document.fullscreenElement, iframe); + assert_equals(doc.fullscreenElement, inner); + + // Now exit fullscreen for the iframe's content document. + doc.exitFullscreen(); + doc.onfullscreenchange = t.step_func_done(() => { + assert_equals(document.fullscreenElement, iframe); + assert_equals(doc.fullscreenElement, outer); + }); + }); + }); + doc.onfullscreenerror = t.unreached_func("fullscreenerror event"); + }); +}); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-nested-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-nested-manual.html new file mode 100644 index 0000000..dfd53bc --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-nested-manual.html
@@ -0,0 +1,31 @@ +<!DOCTYPE html> +<title>Document#exitFullscreen() for nested fullscreen</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../trusted-click.js"></script> +<div><div></div></div> +<script> +async_test(t => { + const outer = document.querySelector("div"); + const inner = outer.firstChild; + + // First request fullscreen for the outer element. + trusted_request(t, outer); + document.onfullscreenchange = t.step_func(() => { + assert_equals(document.fullscreenElement, outer); + + // Then request fullscreen for the inner element. + trusted_request(t, inner); + document.onfullscreenchange = t.step_func(() => { + assert_equals(document.fullscreenElement, inner); + + // Now exit fullscreen. + document.exitFullscreen(); + document.onfullscreenchange = t.step_func_done(() => { + assert_equals(document.fullscreenElement, outer); + }); + }); + }); + document.onfullscreenerror = t.unreached_func("fullscreenerror event"); +}); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-deny.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-deny.https-expected.txt new file mode 100644 index 0000000..61a12c2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-deny.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Tests that the error callback is triggered when permission is denied assert_unreached: The success callback should not be triggered since access is to be denied Reached unreachable code +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-empty-option-param.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-empty-option-param.https-expected.txt new file mode 100644 index 0000000..a303a5a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-empty-option-param.https-expected.txt
@@ -0,0 +1,11 @@ +This is a testharness.js-based test. +FAIL Tests that getUserMedia raises a NOT_SUPPORTED_ERR exception when used with an empty options parameter assert_throws: function "function () { + navigator.getUserMedia({}, t.step_func(function (stream) { + assert_unreached("This should never be triggered since the constraints parameter is empty"); + t.done(); + }), t.step_func(function (error) { + assert_unreached("This should never be triggered since the constraints parameter is empty"); + })); + }" threw object "TypeError: Failed to execute 'getUserMedia' on 'Navigator': At least one of audio and video must be requested" that is not a DOMException NOT_SUPPORTED_ERR: property "code" is equal to undefined, expected 9 +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-impossible-constraint.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-impossible-constraint.https-expected.txt new file mode 100644 index 0000000..d2c418e3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-impossible-constraint.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Tests that setting an impossible constraint in getUserMedia fails assert_unreached: a Video stream of width 100M cannot be created Reached unreachable code +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-unknownkey-option-param.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-unknownkey-option-param.https-expected.txt new file mode 100644 index 0000000..4f7004f9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/GUM-unknownkey-option-param.https-expected.txt
@@ -0,0 +1,12 @@ +This is a testharness.js-based test. +FAIL getUserMedia({doesnotexist:true}) aborts with NOT_SUPPORTED_ERR assert_throws: function "function () { + navigator.getUserMedia( + {doesnotexist:true}, + t.step_func(function (stream) { + assert_unreached("This should never be triggered since the constraints parameter is unrecognized"); + }), t.step_func(function (error) { + assert_unreached("This should never be triggered since the constraints parameter is unrecognized"); + })); + }" threw object "ReferenceError: t is not defined" that is not a DOMException NOT_SUPPORTED_ERR: property "code" is equal to undefined, expected 9 +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none.https-expected.txt new file mode 100644 index 0000000..f30de268 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL Test that preload 'none' is ignored for MediaStream object URL used as src assert_unreached: 'error' should not be fired, code=4 Reached unreachable code +PASS Test that preload 'none' is ignored for MediaStream used as srcObject +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none.https.html b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none.https.html index ce97806a..6b9da9ce 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none.https.html
@@ -21,6 +21,9 @@ { // The optional deferred load steps (for preload none) for MediaStream resources should be skipped. mediaElement.addEventListener("suspend", t.unreached_func("'suspend' should not be fired.")); + mediaElement.addEventListener("error", t.step_func(function() { + assert_unreached("'error' should not be fired, code=" + mediaElement.error.code); + })); mediaElement.addEventListener("loadeddata", t.step_func(function() {
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-srcObject.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-srcObject.https-expected.txt new file mode 100644 index 0000000..2a5c612e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStream-MediaElement-srcObject.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Tests that a MediaStream can be assigned to a video element with srcObject assert_equals: A MediaStream does not have a pre-defined duration. expected Infinity but got NaN +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https-expected.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https-expected.txt
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https-expected.txt new file mode 100644 index 0000000..71bbea7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Tests that a disabled video track in a MediaStream is rendered as blackness assert_equals: No red component in pixel #0 expected 0 but got 255 +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-end.https.html b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-end-manual.https.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-end.https.html rename to third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-end-manual.https.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https-expected.txt new file mode 100644 index 0000000..7205be5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https-expected.txt
@@ -0,0 +1,62 @@ +This is a testharness.js-based test. +PASS Tests that the video MediaStreamTrack objects are properly initialized +PASS EventTarget interface: existence and properties of interface object +PASS EventTarget interface object length +PASS EventTarget interface object name +FAIL EventTarget interface: existence and properties of interface prototype object assert_equals: class string of EventTarget.prototype expected "[object EventTargetPrototype]" but got "[object EventTarget]" +PASS EventTarget interface: existence and properties of interface prototype object's "constructor" property +PASS EventTarget interface: operation addEventListener(DOMString,EventListener,boolean) +PASS EventTarget interface: operation removeEventListener(DOMString,EventListener,boolean) +PASS EventTarget interface: operation dispatchEvent(Event) +PASS MediaStreamTrack interface: existence and properties of interface object +PASS MediaStreamTrack interface object length +PASS MediaStreamTrack interface object name +FAIL MediaStreamTrack interface: existence and properties of interface prototype object assert_equals: class string of MediaStreamTrack.prototype expected "[object MediaStreamTrackPrototype]" but got "[object MediaStreamTrack]" +PASS MediaStreamTrack interface: existence and properties of interface prototype object's "constructor" property +PASS MediaStreamTrack interface: attribute kind +PASS MediaStreamTrack interface: attribute id +PASS MediaStreamTrack interface: attribute label +PASS MediaStreamTrack interface: attribute enabled +PASS MediaStreamTrack interface: attribute muted +PASS MediaStreamTrack interface: attribute onmute +PASS MediaStreamTrack interface: attribute onunmute +FAIL MediaStreamTrack interface: attribute readonly assert_true: The prototype object must have a property "readonly" expected true got false +PASS MediaStreamTrack interface: attribute remote +PASS MediaStreamTrack interface: attribute readyState +PASS MediaStreamTrack interface: attribute onended +FAIL MediaStreamTrack interface: attribute onoverconstrained assert_true: The prototype object must have a property "onoverconstrained" expected true got false +PASS MediaStreamTrack interface: operation clone() +PASS MediaStreamTrack interface: operation stop() +FAIL MediaStreamTrack interface: operation getCapabilities() assert_own_property: interface prototype object missing non-static operation expected property "getCapabilities" missing +PASS MediaStreamTrack interface: operation getConstraints() +PASS MediaStreamTrack interface: operation getSettings() +FAIL MediaStreamTrack interface: operation applyConstraints(MediaTrackConstraints) assert_own_property: interface prototype object missing non-static operation expected property "applyConstraints" missing +PASS MediaStreamTrack must be primary interface of track +PASS Stringification of track +PASS MediaStreamTrack interface: track must inherit property "kind" with the proper type (0) +PASS MediaStreamTrack interface: track must inherit property "id" with the proper type (1) +PASS MediaStreamTrack interface: track must inherit property "label" with the proper type (2) +PASS MediaStreamTrack interface: track must inherit property "enabled" with the proper type (3) +PASS MediaStreamTrack interface: track must inherit property "muted" with the proper type (4) +FAIL MediaStreamTrack interface: track must inherit property "onmute" with the proper type (5) Unrecognized type EventHandler +FAIL MediaStreamTrack interface: track must inherit property "onunmute" with the proper type (6) Unrecognized type EventHandler +FAIL MediaStreamTrack interface: track must inherit property "readonly" with the proper type (7) assert_inherits: property "readonly" not found in prototype chain +PASS MediaStreamTrack interface: track must inherit property "remote" with the proper type (8) +FAIL MediaStreamTrack interface: track must inherit property "readyState" with the proper type (9) Unrecognized type MediaStreamTrackState +FAIL MediaStreamTrack interface: track must inherit property "onended" with the proper type (10) Unrecognized type EventHandler +FAIL MediaStreamTrack interface: track must inherit property "onoverconstrained" with the proper type (11) assert_inherits: property "onoverconstrained" not found in prototype chain +PASS MediaStreamTrack interface: track must inherit property "clone" with the proper type (12) +PASS MediaStreamTrack interface: track must inherit property "stop" with the proper type (13) +FAIL MediaStreamTrack interface: track must inherit property "getCapabilities" with the proper type (14) assert_inherits: property "getCapabilities" not found in prototype chain +PASS MediaStreamTrack interface: track must inherit property "getConstraints" with the proper type (15) +PASS MediaStreamTrack interface: track must inherit property "getSettings" with the proper type (16) +FAIL MediaStreamTrack interface: track must inherit property "applyConstraints" with the proper type (17) assert_inherits: property "applyConstraints" not found in prototype chain +FAIL MediaStreamTrack interface: calling applyConstraints(MediaTrackConstraints) on track with too few arguments must throw TypeError assert_inherits: property "applyConstraints" not found in prototype chain +PASS EventTarget interface: track must inherit property "addEventListener" with the proper type (0) +PASS EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on track with too few arguments must throw TypeError +PASS EventTarget interface: track must inherit property "removeEventListener" with the proper type (1) +PASS EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on track with too few arguments must throw TypeError +PASS EventTarget interface: track must inherit property "dispatchEvent" with the proper type (2) +PASS EventTarget interface: calling dispatchEvent(Event) on track with too few arguments must throw TypeError +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-animations/timing-model/time-transformations/transformed-progress-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/web-animations/timing-model/time-transformations/transformed-progress-expected.txt new file mode 100644 index 0000000..ee5620bc --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/web-animations/timing-model/time-transformations/transformed-progress-expected.txt
@@ -0,0 +1,28 @@ +This is a testharness.js-based test. +PASS Transformed progress for step-start function +PASS Transformed progress for steps(1, start) function +PASS Transformed progress for steps(2, start) function +PASS Transformed progress for step-end function +PASS Transformed progress for steps(1) function +PASS Transformed progress for steps(1, end) function +PASS Transformed progress for steps(2, end) function +PASS Transformed progress for linear function +FAIL Transformed progress for ease function assert_approx_equals: The progress should be approximately 0.40851059137130497 at 250ms expected 0.40851059137130497 +/- 0.01 but got 0.41869212962962965 +PASS Transformed progress for ease-in function +PASS Transformed progress for ease-in-out function +PASS Transformed progress for ease-out function +PASS Transformed progress for easing function which produces values greater than 1 +PASS Transformed progress for easing function which produces values less than 1 +FAIL Test bounds point of step-start easing assert_equals: Progress at 0ms expected 0 but got 0.5 +FAIL Test bounds point of step-start easing with reverse direction assert_equals: Progress at 2000ms expected 0 but got 0.5 +PASS Test bounds point of step-start easing with iterationStart not at a transition point +FAIL Test bounds point of step-start easing with iterationStart and delay assert_equals: Progress at 0ms expected 0.5 but got 1 +FAIL Test bounds point of step-start easing with iterationStart and reverse direction assert_equals: Progress at 2000ms expected 0.5 but got 1 +FAIL Test bounds point of step(4, start) easing with iterationStart 0.75 and delay assert_equals: Progress at 0ms expected 0.75 but got 1 +FAIL Test bounds point of step-start easing with alternate direction assert_equals: Progress at 3000ms expected 0.5 but got 1 +FAIL Test bounds point of step-start easing with alternate-reverse direction assert_equals: Progress at 3000ms expected 0.5 but got 1 +PASS Test bounds point of step-end easing +FAIL Test bounds point of step-end easing with iterationStart and delay assert_equals: Progress at 0ms expected 0 but got 0.5 +PASS Test bounds point of step-end easing with iterationStart not at a transition point +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt_automation/fullscreen/auto-click.js b/third_party/WebKit/LayoutTests/external/wpt_automation/fullscreen/auto-click.js index 2c4723b..81f66f5 100644 --- a/third_party/WebKit/LayoutTests/external/wpt_automation/fullscreen/auto-click.js +++ b/third_party/WebKit/LayoutTests/external/wpt_automation/fullscreen/auto-click.js
@@ -1,15 +1,31 @@ (function() { +// Gets the offset of an element in coordinates relative to the top-level frame. +function offset(element) { + const rect = element.getBoundingClientRect(); + const iframe = element.ownerDocument.defaultView.frameElement; + if (!iframe) { + return { left: rect.left, top: rect.top }; + } + const outerOffset = offset(iframe); + const style = getComputedStyle(iframe); + const get = prop => +/[\d.]*/.exec(style[prop])[0]; + return { + left: outerOffset.left + get('borderLeftWidth') + get('paddingLeft') + rect.left, + top: outerOffset.top + get('borderTopWidth') + get('paddingTop') + rect.top + }; +} + function click(button) { - var rect = button.getBoundingClientRect(); - eventSender.mouseMoveTo(rect.left, rect.top); + const pos = offset(button); + eventSender.mouseMoveTo(Math.ceil(pos.left), Math.ceil(pos.top)); eventSender.mouseDown(); eventSender.mouseUp(); } -var observer = new MutationObserver(mutations => { - for (var mutation of mutations) { - for (var node of mutation.addedNodes) { +const observer = new MutationObserver(mutations => { + for (const mutation of mutations) { + for (const node of mutation.addedNodes) { if (node.localName == 'button') click(node); else if (node.localName == 'iframe') @@ -23,11 +39,14 @@ } // Handle what's already in the document. -for (var button of document.getElementsByTagName('button')) { +for (const button of document.getElementsByTagName('button')) { click(button); } -for (var iframe of document.getElementsByTagName('iframe')) { +for (const iframe of document.getElementsByTagName('iframe')) { observe(iframe.contentDocument); + iframe.addEventListener('load', () => { + observe(iframe.contentDocument); + }); } // Observe future changes.
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html index 03629b8..8ce169d 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html
@@ -33,7 +33,29 @@ assert_true(e instanceof DOMException); assert_equals(e.name, "IndexSizeError"); })); -}, "Test that call convertToBlob on a OffscreenCanvas with size 0 throws exception"); +}, "Test that call convertToBlob on an OffscreenCanvas with size 0 throws exception"); + +async_test(function(t) { + var webp_max_dimension = 16383; // Based on WEBPImageEncoder.cpp?l=52 + var offscreenCanvas = new OffscreenCanvas(10, webp_max_dimension + 1); + var ctx = offscreenCanvas.getContext("2d"); + offscreenCanvas.convertToBlob({type: "image/webp"}).then(t.step_func_done(function() { + assert_false("convertToBlob didn't throw, but should be"); + }), t.step_func_done(function(e) { + assert_true(e instanceof DOMException); + assert_equals(e.name, "EncodingError"); + })); +}, "Test that call convertToBlob throws EncodingError exception when encoding fails"); + +async_test(function(t) { + var offscreenCanvas = new OffscreenCanvas(10, 10); + offscreenCanvas.convertToBlob().then(t.step_func_done(function() { + assert_false("convertToBlob didn't throw, but should be"); + }), t.step_func_done(function(e) { + assert_true(e instanceof DOMException); + assert_equals(e.name, "InvalidStateError"); + })); +}, "Test that call convertToBlob on an OffscreenCanvas without contexts throws exception"); </script>
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-resource-details-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-resource-details-expected.txt index 30ad017..1841b23 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-resource-details-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-resource-details-expected.txt
@@ -6,13 +6,15 @@ Request Method: GET Priority: Low Mime Type: string -Encoded Length: 0 B +Encoded Data: 0 B +Decoded Body: 223 B Initiator: timeline-network-resource-details.html:15 URL: anImage.png Duration: string Request Method: GET Priority: Low Mime Type: string -Encoded Length: 0 B +Encoded Data: 0 B +Decoded Body: 12.9 KB Preview:
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-resource-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-resource-expected.txt index 46b7b48..0f117dc 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-resource-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-resource-expected.txt
@@ -41,6 +41,7 @@ ResourceFinish Properties: { data : { + decodedBodyLength : 223 didFail : false encodedDataLength : <number> finishTime : <number>
diff --git a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-during-setmediakeys.html b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-during-setmediakeys.html new file mode 100644 index 0000000..eb7a65d0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-during-setmediakeys.html
@@ -0,0 +1,73 @@ +<!DOCTYPE html> +<html> + <head> + <title>Reset src during setMediaKeys()</title> + <script src="encrypted-media-utils.js"></script> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + </head> + <body> + <video></video> + <script> + async_test(function(test) + { + var mediaKeys; + var video = document.querySelector('video'); + assert_not_equals(video, null); + var encryptedEventIndex = 0; + + // Content to be played. These files must be the same format. + var content = '../content/test-encrypted.webm'; + var alternateContent = '../content/test-encrypted-different-av-keys.webm'; + + function setMediaKeys() { + // Create a MediaKeys object and assign it to video. + video.setMediaKeys(mediaKeys) + .then(function(result) { + // setMediaKeys() should succeed even if src is reset before setMediaKeys() promise is resolved. + assert_not_equals(video.mediaKeys, null, 'set successfully'); + assert_true(video.mediaKeys === mediaKeys); + }) + .catch(function(error) { + forceTestFailureFromPromise(test, error); + }); + } + + var onEncrypted = function(event) + { + encryptedEventIndex++; + + // This event is fired once for the audio stream and once + // for the video stream each time .src is set. + if (encryptedEventIndex == 2) { + assert_equals(video.mediaKeys, null); + setMediaKeys(); + + // Reset src without waiting for setMediaKeys() to finish. + video.src = alternateContent; + } else if (encryptedEventIndex == 4) { + // Finished second video. + test.done(); + } + }; + + navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)) + .then(function(access) { + assert_equals(access.keySystem, 'org.w3.clearkey'); + return access.createMediaKeys(); + }) + .then(function(result) { + mediaKeys = result; + assert_not_equals(mediaKeys, null); + + // Set src without setMediaKeys(). + video.src = content; + waitForEventAndRunStep('encrypted', video, onEncrypted, test); + }) + .catch(function(error) { + forceTestFailureFromPromise(test, error); + }) + }, 'Reset src during setMediaKeys().'); + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/platform/linux/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt new file mode 100644 index 0000000..baf644b --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt
@@ -0,0 +1,41 @@ +This is a testharness.js-based test. +PASS A step-start function on a keyframe affects the resulting style +PASS A steps(1, start) function on a keyframe affects the resulting style +PASS A steps(2, start) function on a keyframe affects the resulting style +PASS A step-end function on a keyframe affects the resulting style +PASS A steps(1) function on a keyframe affects the resulting style +PASS A steps(1, end) function on a keyframe affects the resulting style +PASS A steps(2, end) function on a keyframe affects the resulting style +PASS A linear function on a keyframe affects the resulting style +FAIL A ease function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 109.47963055884654 at 1100ms expected 109.47963055884654 +/- 0.01 but got 109.312 +PASS A ease-in function on a keyframe affects the resulting style +FAIL A ease-in-out function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 101.97224534417684 at 1100ms expected 101.97224534417684 +/- 0.01 but got 101.953 +FAIL A ease-out function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 116.05721544376388 at 1100ms expected 116.05721544376388 +/- 0.01 but got 116.078 +FAIL A easing function which produces values greater than 1 on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 171.60874310990272 at 1100ms expected 171.60874310990272 +/- 0.01 but got 172.219 +FAIL A easing function which produces values less than 1 on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 77.13128857063907 at 1100ms expected 77.13128857063907 +/- 0.01 but got 76.9531 +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a step-start function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1, start) function does not alter the result +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(2, start) function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 0ms expected "50.3438px" but got "50px" +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a step-end function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1) function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1, end) function does not alter the result +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(2, end) function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 500ms expected "50.3438px" but got "50px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a linear function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "25.0938px" but got "25px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "41.875px" but got "41.8594px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-in function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "8.95312px" but got "9.32812px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-in-out function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "12.9375px" but got "12.875px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-out function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "38.0469px" but got "37.9688px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a easing function which produces values greater than 1 does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "100px" but got "102.406px" +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a easing function which produces values less than 1 does not alter the result +FAIL step-start easing with input progress greater than 1 assert_equals: expected "200px" but got "100px" +PASS step-end easing with input progress greater than 1 +FAIL step-end easing with input progress greater than 2 assert_equals: expected "200px" but got "100px" +PASS step-start easing with input progress less than 0 +FAIL step-start easing with input progress less than -1 assert_equals: expected "-100px" but got "0px" +FAIL step-end easing with input progress less than 0 assert_equals: expected "-100px" but got "0px" +FAIL cubic-bezier easing with input progress greater than 1 Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress greater than 1 and where the tangent on the upper boundary is infinity Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress less than 0 Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress less than 0 and where the tangent on the lower boundary is infinity Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt new file mode 100644 index 0000000..baf644b --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt
@@ -0,0 +1,41 @@ +This is a testharness.js-based test. +PASS A step-start function on a keyframe affects the resulting style +PASS A steps(1, start) function on a keyframe affects the resulting style +PASS A steps(2, start) function on a keyframe affects the resulting style +PASS A step-end function on a keyframe affects the resulting style +PASS A steps(1) function on a keyframe affects the resulting style +PASS A steps(1, end) function on a keyframe affects the resulting style +PASS A steps(2, end) function on a keyframe affects the resulting style +PASS A linear function on a keyframe affects the resulting style +FAIL A ease function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 109.47963055884654 at 1100ms expected 109.47963055884654 +/- 0.01 but got 109.312 +PASS A ease-in function on a keyframe affects the resulting style +FAIL A ease-in-out function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 101.97224534417684 at 1100ms expected 101.97224534417684 +/- 0.01 but got 101.953 +FAIL A ease-out function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 116.05721544376388 at 1100ms expected 116.05721544376388 +/- 0.01 but got 116.078 +FAIL A easing function which produces values greater than 1 on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 171.60874310990272 at 1100ms expected 171.60874310990272 +/- 0.01 but got 172.219 +FAIL A easing function which produces values less than 1 on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 77.13128857063907 at 1100ms expected 77.13128857063907 +/- 0.01 but got 76.9531 +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a step-start function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1, start) function does not alter the result +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(2, start) function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 0ms expected "50.3438px" but got "50px" +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a step-end function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1) function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1, end) function does not alter the result +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(2, end) function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 500ms expected "50.3438px" but got "50px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a linear function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "25.0938px" but got "25px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "41.875px" but got "41.8594px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-in function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "8.95312px" but got "9.32812px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-in-out function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "12.9375px" but got "12.875px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-out function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "38.0469px" but got "37.9688px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a easing function which produces values greater than 1 does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "100px" but got "102.406px" +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a easing function which produces values less than 1 does not alter the result +FAIL step-start easing with input progress greater than 1 assert_equals: expected "200px" but got "100px" +PASS step-end easing with input progress greater than 1 +FAIL step-end easing with input progress greater than 2 assert_equals: expected "200px" but got "100px" +PASS step-start easing with input progress less than 0 +FAIL step-start easing with input progress less than -1 assert_equals: expected "-100px" but got "0px" +FAIL step-end easing with input progress less than 0 assert_equals: expected "-100px" but got "0px" +FAIL cubic-bezier easing with input progress greater than 1 Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress greater than 1 and where the tangent on the upper boundary is infinity Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress less than 0 Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress less than 0 and where the tangent on the lower boundary is infinity Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt new file mode 100644 index 0000000..f967c05 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt
@@ -0,0 +1,41 @@ +This is a testharness.js-based test. +PASS A step-start function on a keyframe affects the resulting style +PASS A steps(1, start) function on a keyframe affects the resulting style +PASS A steps(2, start) function on a keyframe affects the resulting style +PASS A step-end function on a keyframe affects the resulting style +PASS A steps(1) function on a keyframe affects the resulting style +PASS A steps(1, end) function on a keyframe affects the resulting style +PASS A steps(2, end) function on a keyframe affects the resulting style +PASS A linear function on a keyframe affects the resulting style +FAIL A ease function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 109.47963055884654 at 1100ms expected 109.47963055884654 +/- 0.01 but got 109.313 +PASS A ease-in function on a keyframe affects the resulting style +FAIL A ease-in-out function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 101.97224534417684 at 1100ms expected 101.97224534417684 +/- 0.01 but got 101.953 +FAIL A ease-out function on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 116.05721544376388 at 1100ms expected 116.05721544376388 +/- 0.01 but got 116.078 +FAIL A easing function which produces values greater than 1 on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 171.60874310990272 at 1100ms expected 171.60874310990272 +/- 0.01 but got 172.219 +FAIL A easing function which produces values less than 1 on a keyframe affects the resulting style assert_approx_equals: The width should be approximately 77.13128857063907 at 1100ms expected 77.13128857063907 +/- 0.01 but got 76.9531 +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a step-start function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1, start) function does not alter the result +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(2, start) function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 0ms expected "50.3438px" but got "50px" +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a step-end function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1) function does not alter the result +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(1, end) function does not alter the result +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a steps(2, end) function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 500ms expected "50.3438px" but got "50px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a linear function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "25.0938px" but got "25px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "41.875px" but got "41.8594px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-in function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "8.95313px" but got "9.32813px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-in-out function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "12.9375px" but got "12.875px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a ease-out function does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "38.0469px" but got "37.9688px" +FAIL Linear-equivalent cubic-bezier keyframe easing applied to an effect with a easing function which produces values greater than 1 does not alter the result assert_equals: The 'width' of the animated elements should be equal at 250ms expected "100px" but got "102.406px" +PASS Linear-equivalent cubic-bezier keyframe easing applied to an effect with a easing function which produces values less than 1 does not alter the result +FAIL step-start easing with input progress greater than 1 assert_equals: expected "200px" but got "100px" +PASS step-end easing with input progress greater than 1 +FAIL step-end easing with input progress greater than 2 assert_equals: expected "200px" but got "100px" +PASS step-start easing with input progress less than 0 +FAIL step-start easing with input progress less than -1 assert_equals: expected "-100px" but got "0px" +FAIL step-end easing with input progress less than 0 assert_equals: expected "-100px" but got "0px" +FAIL cubic-bezier easing with input progress greater than 1 Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress greater than 1 and where the tangent on the upper boundary is infinity Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress less than 0 Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +FAIL cubic-bezier easing with input progress less than 0 and where the tangent on the lower boundary is infinity Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/resources/testharnessreport.js b/third_party/WebKit/LayoutTests/resources/testharnessreport.js index c3d3ff94..96f2dd2 100644 --- a/third_party/WebKit/LayoutTests/resources/testharnessreport.js +++ b/third_party/WebKit/LayoutTests/resources/testharnessreport.js
@@ -80,7 +80,7 @@ var path = location.pathname; if (location.hostname == 'web-platform.test' && path.endsWith('-manual.html')) return true; - return /\/imported\/wpt\/.*-manual\.html$/.test(path); + return /\/external\/wpt\/.*-manual\.html$/.test(path); } // Returns a directory part relative to WPT root and a basename part of the @@ -93,7 +93,7 @@ var matches = path.match(/^(\/.*)\.html$/); return matches ? matches[1] : null; } - var matches = path.match(/imported\/wpt(\/.*)\.html$/); + var matches = path.match(/external\/wpt(\/.*)\.html$/); return matches ? matches[1] : null; } @@ -101,7 +101,7 @@ var pathAndBase = pathAndBaseNameInWPT(); if (!pathAndBase) return; - var automationPath = location.pathname.replace(/\/imported\/wpt\/.*$/, '/external/wpt_automation'); + var automationPath = location.pathname.replace(/\/external\/wpt\/.*$/, '/external/wpt_automation'); if (location.hostname == 'web-platform.test') automationPath = '/wpt_automation';
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp index 066f991..f10d8fc 100644 --- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp +++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -424,7 +424,7 @@ // TODO(tkent): According to the specification, we should remove |newChild| // from its parent here, and create a separated mutation record for it. - // Refer to imported/wpt/dom/nodes/MutationObserver-childList.html. + // Refer to external/wpt/dom/nodes/MutationObserver-childList.html. // 12. If child’s parent is not null, run these substeps: // 1. Set removedNodes to a list solely containing child.
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index b8178d8a..d8fc1a43 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -406,10 +406,11 @@ } class Document::NetworkStateObserver final - : public GarbageCollected<Document::NetworkStateObserver>, + : public GarbageCollectedFinalized<Document::NetworkStateObserver>, public NetworkStateNotifier::NetworkStateObserver, public ContextLifecycleObserver { USING_GARBAGE_COLLECTED_MIXIN(Document::NetworkStateObserver); + EAGERLY_FINALIZE(); public: explicit NetworkStateObserver(Document& document) @@ -419,6 +420,9 @@ TaskRunnerHelper::get(TaskType::Networking, getExecutionContext())); } + // We eagerly finalize, so it's safe to touch getExecutionContext() here. + ~NetworkStateObserver() { unregisterAsObserver(getExecutionContext()); } + void onLineStateChange(bool onLine) override { AtomicString eventName = onLine ? EventTypeNames::online : EventTypeNames::offline; @@ -430,6 +434,12 @@ } void contextDestroyed(ExecutionContext* context) override { + unregisterAsObserver(context); + } + + void unregisterAsObserver(ExecutionContext* context) { + if (!context) + return; networkStateNotifier().removeOnLineObserver( this, TaskRunnerHelper::get(TaskType::Networking, context)); } @@ -2629,11 +2639,11 @@ if (!settings || !settings->getAccessibilityEnabled()) return 0; - // The only document that actually has a AXObjectCache is the top-level - // document. This is because we need to be able to get from any - // WebCoreAXObject to any other WebCoreAXObject on the same page. Using a - // single cache allows lookups across nested webareas (i.e. multiple - // documents). + // Every document has its own AXObjectCache if accessibility is enabled, + // except for page popups (such as select popups or context menus), + // which share the AXObjectCache of their owner. + // + // See http://crbug.com/532249 Document& cacheOwner = this->axObjectCacheOwner(); // If the document has already been detached, do not make a new axObjectCache.
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp index a4b809f4..99d80457 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -4,6 +4,7 @@ #include "core/html/canvas/CanvasAsyncBlobCreator.h" +#include "core/dom/DOMException.h" #include "core/dom/Document.h" #include "core/dom/TaskRunnerHelper.h" #include "core/fileapi/Blob.h" @@ -478,8 +479,8 @@ WTF::bind(&BlobCallback::handleEvent, wrapPersistent(m_callback.get()), nullptr)); } else { - Blob* blob = nullptr; - m_scriptPromiseResolver->reject(blob); + m_scriptPromiseResolver->reject(DOMException::create( + EncodingError, "Encoding of the source image has failed.")); } // Avoid unwanted retention, see dispose(). dispose(); @@ -492,10 +493,10 @@ if (!ImageDataBuffer(m_size, m_data->data()) .encodeImage("image/webp", quality, m_encodedImage.get())) { m_parentFrameTaskRunner->get(TaskType::CanvasBlobSerialization) - ->postTask(BLINK_FROM_HERE, - crossThreadBind(&BlobCallback::handleEvent, - wrapCrossThreadPersistent(m_callback.get()), - nullptr)); + ->postTask( + BLINK_FROM_HERE, + crossThreadBind(&CanvasAsyncBlobCreator::createNullAndReturnResult, + wrapCrossThreadPersistent(this))); return; }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp index b2db6fe..21d29b5 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
@@ -596,13 +596,15 @@ unsigned long identifier, double finishTime, bool didFail, - int64_t encodedDataLength) { + int64_t encodedDataLength, + int64_t decodedBodyLength) { String requestId = IdentifiersFactory::requestId(identifier); std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setBoolean("didFail", didFail); value->setDouble("encodedDataLength", encodedDataLength); + value->setDouble("decodedBodyLength", decodedBodyLength); if (finishTime) value->setDouble("finishTime", finishTime); return value;
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h index b120539..b0d6478 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h +++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
@@ -218,7 +218,8 @@ std::unique_ptr<TracedValue> data(unsigned long identifier, double finishTime, bool didFail, - int64_t encodedDataLength); + int64_t encodedDataLength, + int64_t decodedBodyLength); } namespace InspectorTimerInstallEvent {
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index fa4b189..fafeadd 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -491,10 +491,12 @@ void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, double finishTime, - int64_t encodedDataLength) { - TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", - InspectorResourceFinishEvent::data(identifier, finishTime, false, - encodedDataLength)); + int64_t encodedDataLength, + int64_t decodedBodyLength) { + TRACE_EVENT1( + "devtools.timeline", "ResourceFinish", "data", + InspectorResourceFinishEvent::data(identifier, finishTime, false, + encodedDataLength, decodedBodyLength)); frame()->loader().progress().completeProgress(identifier); InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, encodedDataLength); @@ -508,7 +510,7 @@ bool isInternalRequest) { TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", InspectorResourceFinishEvent::data(identifier, 0, true, - encodedDataLength)); + encodedDataLength, 0)); frame()->loader().progress().completeProgress(identifier); InspectorInstrumentation::didFailLoading(frame(), identifier, error); // Notification to FrameConsole should come AFTER InspectorInstrumentation @@ -542,7 +544,8 @@ if (resource->encodedSize() > 0) dispatchDidReceiveData(identifier, 0, resource->encodedSize()); - dispatchDidFinishLoading(identifier, 0, 0); + dispatchDidFinishLoading(identifier, 0, 0, + resource->response().decodedBodyLength()); } bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const {
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.h b/third_party/WebKit/Source/core/loader/FrameFetchContext.h index b88644f..28be0ce 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.h +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.h
@@ -107,7 +107,8 @@ int encodedDataLength) override; void dispatchDidFinishLoading(unsigned long identifier, double finishTime, - int64_t encodedDataLength) override; + int64_t encodedDataLength, + int64_t decodedBodyLength) override; void dispatchDidFail(unsigned long identifier, const ResourceError&, int64_t encodedDataLength,
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.cpp b/third_party/WebKit/Source/core/loader/PingLoader.cpp index 6afde83..aa1817f8 100644 --- a/third_party/WebKit/Source/core/loader/PingLoader.cpp +++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -342,8 +342,9 @@ void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) { if (frame()) { - TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", - InspectorResourceFinishEvent::data(m_identifier, 0, true, 0)); + TRACE_EVENT1( + "devtools.timeline", "ResourceFinish", "data", + InspectorResourceFinishEvent::data(m_identifier, 0, true, 0, 0)); const ResourceResponse& resourceResponse = response.toResourceResponse(); InspectorInstrumentation::didReceiveResourceResponse( frame(), m_identifier, 0, resourceResponse, 0); @@ -354,9 +355,9 @@ void PingLoaderImpl::didReceiveData(const char*, int dataLength) { if (frame()) { - TRACE_EVENT1( - "devtools.timeline", "ResourceFinish", "data", - InspectorResourceFinishEvent::data(m_identifier, 0, true, dataLength)); + TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", + InspectorResourceFinishEvent::data(m_identifier, 0, true, + dataLength, 0)); didFailLoading(frame()); } dispose(); @@ -368,7 +369,7 @@ if (frame()) { TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true, - encodedDataLength)); + encodedDataLength, 0)); didFailLoading(frame()); } dispose(); @@ -380,7 +381,7 @@ if (frame()) { TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true, - encodedDataLength)); + encodedDataLength, 0)); didFailLoading(frame()); } dispose(); @@ -388,8 +389,9 @@ void PingLoaderImpl::timeout(TimerBase*) { if (frame()) { - TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", - InspectorResourceFinishEvent::data(m_identifier, 0, true, 0)); + TRACE_EVENT1( + "devtools.timeline", "ResourceFinish", "data", + InspectorResourceFinishEvent::data(m_identifier, 0, true, 0, 0)); didFailLoading(frame()); } dispose();
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp index ea7dd1d0..a41f0c6 100644 --- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp +++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -305,7 +305,9 @@ imageData = this->renderingContext()->toImageData(SnapshotReasonUnknown); } if (!imageData) { - return ScriptPromise(); + exceptionState.throwDOMException( + InvalidStateError, "OffscreenCanvas object has no rendering contexts"); + return exceptionState.reject(scriptState); } ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp b/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp index 848d763..9e1233a 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp
@@ -156,23 +156,17 @@ const AttributeModificationParams& params) { if (params.name == SVGNames::attributeTypeAttr) { setAttributeType(params.newValue); + animationAttributeChanged(); + return; + } + if (params.name == SVGNames::attributeNameAttr) { + setAttributeName(constructQualifiedName(*this, params.newValue)); + animationAttributeChanged(); return; } SVGAnimationElement::parseAttribute(params); } -void SVGAnimateElement::svgAttributeChanged(const QualifiedName& attrName) { - if (attrName == SVGNames::attributeTypeAttr) { - } else if (attrName == SVGNames::attributeNameAttr) { - setAttributeName(constructQualifiedName( - *this, fastGetAttribute(SVGNames::attributeNameAttr))); - } else { - SVGAnimationElement::svgAttributeChanged(attrName); - return; - } - animationAttributeChanged(); -} - void SVGAnimateElement::resolveTargetProperty() { DCHECK(targetElement()); m_targetProperty = targetElement()->propertyFromAttribute(attributeName());
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimateElement.h b/third_party/WebKit/Source/core/svg/SVGAnimateElement.h index 5f40cd3..6392522 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimateElement.h +++ b/third_party/WebKit/Source/core/svg/SVGAnimateElement.h
@@ -74,7 +74,6 @@ bool isAdditive() final; void parseAttribute(const AttributeModificationParams&) override; - void svgAttributeChanged(const QualifiedName&) override; void setTargetElement(SVGElement*) final; void setAttributeName(const QualifiedName&);
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimatedPath.cpp b/third_party/WebKit/Source/core/svg/SVGAnimatedPath.cpp index a282154..1dd30a6 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimatedPath.cpp +++ b/third_party/WebKit/Source/core/svg/SVGAnimatedPath.cpp
@@ -30,6 +30,8 @@ #include "core/svg/SVGAnimatedPath.h" +#include "core/css/CSSIdentifierValue.h" + namespace blink { SVGAnimatedPath::SVGAnimatedPath(SVGElement* contextElement, @@ -42,4 +44,11 @@ SVGAnimatedPath::~SVGAnimatedPath() {} +const CSSValue* SVGAnimatedPath::cssValue() const { + const CSSPathValue* pathValue = currentValue()->pathValue(); + if (pathValue->stylePath()->byteStream().isEmpty()) + return CSSIdentifierValue::create(CSSValueNone); + return pathValue; +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimatedPath.h b/third_party/WebKit/Source/core/svg/SVGAnimatedPath.h index 4502c6b..e590453 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimatedPath.h +++ b/third_party/WebKit/Source/core/svg/SVGAnimatedPath.h
@@ -47,6 +47,8 @@ return new SVGAnimatedPath(contextElement, attributeName, cssPropertyId); } + const CSSValue* cssValue() const; + protected: SVGAnimatedPath(SVGElement*, const QualifiedName&,
diff --git a/third_party/WebKit/Source/core/svg/SVGCircleElement.cpp b/third_party/WebKit/Source/core/svg/SVGCircleElement.cpp index 42bd6a8..162c2431 100644 --- a/third_party/WebKit/Source/core/svg/SVGCircleElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGCircleElement.cpp
@@ -83,13 +83,13 @@ MutableStylePropertySet* style) { SVGAnimatedPropertyBase* property = propertyFromAttribute(name); if (property == m_cx) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyCx, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_cx->cssValue()); } else if (property == m_cy) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyCy, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_cy->cssValue()); } else if (property == m_r) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyR, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_r->cssValue()); } else { SVGGeometryElement::collectStyleForPresentationAttribute(name, value,
diff --git a/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp b/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp index 7421058..e3c75954 100644 --- a/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp
@@ -96,16 +96,16 @@ MutableStylePropertySet* style) { SVGAnimatedPropertyBase* property = propertyFromAttribute(name); if (property == m_cx) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyCx, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_cx->cssValue()); } else if (property == m_cy) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyCy, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_cy->cssValue()); } else if (property == m_rx) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyRx, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_rx->cssValue()); } else if (property == m_ry) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyRy, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_ry->cssValue()); } else { SVGGeometryElement::collectStyleForPresentationAttribute(name, value,
diff --git a/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp b/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp index daf86ff..54a8bd3 100644 --- a/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp
@@ -71,16 +71,16 @@ MutableStylePropertySet* style) { SVGAnimatedPropertyBase* property = propertyFromAttribute(name); if (property == m_width) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_width->cssValue()); } else if (property == m_height) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_height->cssValue()); } else if (property == m_x) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyX, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_x->cssValue()); } else if (property == m_y) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyY, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_y->cssValue()); } else { SVGGraphicsElement::collectStyleForPresentationAttribute(name, value,
diff --git a/third_party/WebKit/Source/core/svg/SVGImageElement.cpp b/third_party/WebKit/Source/core/svg/SVGImageElement.cpp index 4dc7f4e..99f083ea 100644 --- a/third_party/WebKit/Source/core/svg/SVGImageElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGImageElement.cpp
@@ -91,16 +91,16 @@ MutableStylePropertySet* style) { SVGAnimatedPropertyBase* property = propertyFromAttribute(name); if (property == m_width) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_width->cssValue()); } else if (property == m_height) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_height->cssValue()); } else if (property == m_x) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyX, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_x->cssValue()); } else if (property == m_y) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyY, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_y->cssValue()); } else { SVGGraphicsElement::collectStyleForPresentationAttribute(name, value,
diff --git a/third_party/WebKit/Source/core/svg/SVGMaskElement.cpp b/third_party/WebKit/Source/core/svg/SVGMaskElement.cpp index eadc802..11a3e61 100644 --- a/third_party/WebKit/Source/core/svg/SVGMaskElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGMaskElement.cpp
@@ -94,16 +94,16 @@ MutableStylePropertySet* style) { SVGAnimatedPropertyBase* property = propertyFromAttribute(name); if (property == m_x) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyX, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_x->cssValue()); } else if (property == m_y) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyY, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_y->cssValue()); } else if (property == m_width) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_width->cssValue()); } else if (property == m_height) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_height->cssValue()); } else { SVGElement::collectStyleForPresentationAttribute(name, value, style);
diff --git a/third_party/WebKit/Source/core/svg/SVGPathElement.cpp b/third_party/WebKit/Source/core/svg/SVGPathElement.cpp index c2bd58a4..481e10e 100644 --- a/third_party/WebKit/Source/core/svg/SVGPathElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGPathElement.cpp
@@ -20,7 +20,6 @@ #include "core/svg/SVGPathElement.h" -#include "core/css/CSSIdentifierValue.h" #include "core/dom/StyleChangeReason.h" #include "core/layout/svg/LayoutSVGPath.h" #include "core/svg/SVGMPathElement.h" @@ -120,14 +119,8 @@ // geometry sharing. if (const SVGElement* element = correspondingElement()) path = toSVGPathElement(element)->path(); - - CSSPathValue* pathValue = path->currentValue()->pathValue(); - if (pathValue->stylePath()->byteStream().isEmpty()) { - addPropertyToPresentationAttributeStyle( - style, CSSPropertyD, CSSIdentifierValue::create(CSSValueNone)); - return; - } - addPropertyToPresentationAttributeStyle(style, CSSPropertyD, pathValue); + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), + path->cssValue()); return; } SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style);
diff --git a/third_party/WebKit/Source/core/svg/SVGRectElement.cpp b/third_party/WebKit/Source/core/svg/SVGRectElement.cpp index 4320bcb..0d7360d 100644 --- a/third_party/WebKit/Source/core/svg/SVGRectElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGRectElement.cpp
@@ -122,22 +122,22 @@ MutableStylePropertySet* style) { SVGAnimatedPropertyBase* property = propertyFromAttribute(name); if (property == m_x) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyX, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_x->cssValue()); } else if (property == m_y) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyY, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_y->cssValue()); } else if (property == m_width) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_width->cssValue()); } else if (property == m_height) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_height->cssValue()); } else if (property == m_rx) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyRx, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_rx->cssValue()); } else if (property == m_ry) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyRy, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_ry->cssValue()); } else { SVGGeometryElement::collectStyleForPresentationAttribute(name, value,
diff --git a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp index 5cdb55aa..eec5eb4 100644 --- a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
@@ -230,18 +230,18 @@ MutableStylePropertySet* style) { SVGAnimatedPropertyBase* property = propertyFromAttribute(name); if (property == m_x) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyX, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_x->cssValue()); } else if (property == m_y) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyY, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_y->cssValue()); } else if (isOutermostSVGSVGElement() && (property == m_width || property == m_height)) { if (property == m_width) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_width->cssValue()); } else if (property == m_height) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_height->cssValue()); } } else {
diff --git a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp index 947e974..9d99cfd4 100644 --- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
@@ -180,10 +180,10 @@ MutableStylePropertySet* style) { SVGAnimatedPropertyBase* property = propertyFromAttribute(name); if (property == m_x) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyX, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_x->cssValue()); } else if (property == m_y) { - addPropertyToPresentationAttributeStyle(style, CSSPropertyY, + addPropertyToPresentationAttributeStyle(style, property->cssPropertyId(), m_y->cssValue()); } else { SVGGraphicsElement::collectStyleForPresentationAttribute(name, value,
diff --git a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp index b7f10aa..cbf3a6d 100644 --- a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp +++ b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
@@ -124,15 +124,10 @@ m_animation->handleConditionEvent(event, m_condition); } -void SVGSMILElement::Condition::setEventListener( - ConditionEventListener* eventListener) { - m_eventListener = eventListener; -} - SVGSMILElement::Condition::Condition(Type type, BeginOrEnd beginOrEnd, - const String& baseID, - const String& name, + const AtomicString& baseID, + const AtomicString& name, SMILTime offset, int repeat) : m_type(type), @@ -142,6 +137,76 @@ m_offset(offset), m_repeat(repeat) {} +SVGSMILElement::Condition::~Condition() = default; + +DEFINE_TRACE(SVGSMILElement::Condition) { + visitor->trace(m_syncBase); + visitor->trace(m_eventListener); +} + +void SVGSMILElement::Condition::connectSyncBase(SVGSMILElement& timedElement) { + DCHECK(!m_baseID.isEmpty()); + Element* element = timedElement.treeScope().getElementById(m_baseID); + if (!element || !isSVGSMILElement(*element)) { + m_syncBase = nullptr; + return; + } + m_syncBase = toSVGSMILElement(element); + m_syncBase->addSyncBaseDependent(timedElement); +} + +void SVGSMILElement::Condition::disconnectSyncBase( + SVGSMILElement& timedElement) { + if (!m_syncBase) + return; + m_syncBase->removeSyncBaseDependent(timedElement); + m_syncBase = nullptr; +} + +SVGElement* SVGSMILElement::Condition::lookupEventBase( + SVGSMILElement& timedElement) const { + Element* eventBase = m_baseID.isEmpty() + ? timedElement.targetElement() + : timedElement.treeScope().getElementById(m_baseID); + if (!eventBase || !eventBase->isSVGElement()) + return nullptr; + return toSVGElement(eventBase); +} + +void SVGSMILElement::Condition::connectEventBase(SVGSMILElement& timedElement) { + DCHECK(!m_syncBase); + SVGElement* eventBase = lookupEventBase(timedElement); + if (!eventBase) { + if (m_baseID.isEmpty()) + return; + SVGTreeScopeResources& treeScopeResources = + timedElement.treeScope().ensureSVGTreeScopedResources(); + if (!treeScopeResources.isElementPendingResource(timedElement, m_baseID)) + treeScopeResources.addPendingResource(m_baseID, timedElement); + return; + } + DCHECK(!m_eventListener); + m_eventListener = ConditionEventListener::create(&timedElement, this); + eventBase->addEventListener(m_name, m_eventListener, false); + timedElement.addReferenceTo(eventBase); +} + +void SVGSMILElement::Condition::disconnectEventBase( + SVGSMILElement& timedElement) { + DCHECK(!m_syncBase); + if (!m_eventListener) + return; + // Note: It's a memory optimization to try to remove our condition event + // listener, but it's not guaranteed to work, since we have no guarantee that + // we will be able to find our condition's original eventBase. So, we also + // have to disconnect ourselves from our condition event listener, in case it + // later fires. + if (SVGElement* eventBase = lookupEventBase(timedElement)) + eventBase->removeEventListener(m_name, m_eventListener, false); + m_eventListener->disconnectAnimation(); + m_eventListener = nullptr; +} + SVGSMILElement::SVGSMILElement(const QualifiedName& tagName, Document& doc) : SVGElement(tagName, doc), SVGTests(this), @@ -413,7 +478,8 @@ } m_conditions.push_back( - Condition::create(type, beginOrEnd, baseID, nameString, offset, repeat)); + Condition::create(type, beginOrEnd, AtomicString(baseID), + AtomicString(nameString), offset, repeat)); if (type == Condition::EventBase && beginOrEnd == End) m_hasEndEventConditions = true; @@ -454,16 +520,24 @@ parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End); } parseBeginOrEnd(value.getString(), Begin); - if (isConnected()) + if (isConnected()) { connectSyncBaseConditions(); + connectEventBaseConditions(); + beginListChanged(elapsed()); + } + animationAttributeChanged(); } else if (name == SVGNames::endAttr) { if (!m_conditions.isEmpty()) { clearConditions(); parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin); } parseBeginOrEnd(value.getString(), End); - if (isConnected()) + if (isConnected()) { connectSyncBaseConditions(); + connectEventBaseConditions(); + endListChanged(elapsed()); + } + animationAttributeChanged(); } else if (name == SVGNames::onbeginAttr) { setAttributeEventListener( EventTypeNames::beginEvent, @@ -500,14 +574,6 @@ buildPendingResource(); if (m_targetElement) clearAnimatedType(); - } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr) { - if (isConnected()) { - connectEventBaseConditions(); - if (attrName == SVGNames::beginAttr) - beginListChanged(elapsed()); - else if (attrName == SVGNames::endAttr) - endListChanged(elapsed()); - } } else { SVGElement::svgAttributeChanged(attrName); return; @@ -516,34 +582,13 @@ animationAttributeChanged(); } -inline SVGElement* SVGSMILElement::eventBaseFor(const Condition& condition) { - Element* eventBase = - condition.baseID().isEmpty() - ? targetElement() - : treeScope().getElementById(AtomicString(condition.baseID())); - if (eventBase && eventBase->isSVGElement()) - return toSVGElement(eventBase); - return nullptr; -} - void SVGSMILElement::connectSyncBaseConditions() { if (m_syncBaseConditionsConnected) disconnectSyncBaseConditions(); m_syncBaseConditionsConnected = true; - for (unsigned n = 0; n < m_conditions.size(); ++n) { - Condition* condition = m_conditions[n].get(); - if (condition->getType() == Condition::Syncbase) { - ASSERT(!condition->baseID().isEmpty()); - Element* element = - treeScope().getElementById(AtomicString(condition->baseID())); - if (!element || !isSVGSMILElement(*element)) { - condition->setSyncBase(0); - continue; - } - SVGSMILElement* svgSMILElement = toSVGSMILElement(element); - condition->setSyncBase(svgSMILElement); - svgSMILElement->addSyncBaseDependent(this); - } + for (Condition* condition : m_conditions) { + if (condition->getType() == Condition::Syncbase) + condition->connectSyncBase(*this); } } @@ -551,63 +596,24 @@ if (!m_syncBaseConditionsConnected) return; m_syncBaseConditionsConnected = false; - for (unsigned n = 0; n < m_conditions.size(); ++n) { - Condition* condition = m_conditions[n].get(); - if (condition->getType() == Condition::Syncbase) { - if (condition->syncBase()) - condition->syncBase()->removeSyncBaseDependent(this); - condition->setSyncBase(0); - } + for (Condition* condition : m_conditions) { + if (condition->getType() == Condition::Syncbase) + condition->disconnectSyncBase(*this); } } void SVGSMILElement::connectEventBaseConditions() { disconnectEventBaseConditions(); - for (unsigned n = 0; n < m_conditions.size(); ++n) { - Condition* condition = m_conditions[n].get(); - if (condition->getType() == Condition::EventBase) { - ASSERT(!condition->syncBase()); - SVGElement* eventBase = eventBaseFor(*condition); - if (!eventBase) { - if (!condition->baseID().isEmpty() && - !treeScope() - .ensureSVGTreeScopedResources() - .isElementPendingResource(*this, - AtomicString(condition->baseID()))) { - treeScope().ensureSVGTreeScopedResources().addPendingResource( - AtomicString(condition->baseID()), *this); - } - continue; - } - ASSERT(!condition->eventListener()); - condition->setEventListener( - ConditionEventListener::create(this, condition)); - eventBase->addEventListener(AtomicString(condition->name()), - condition->eventListener(), false); - addReferenceTo(eventBase); - } + for (Condition* condition : m_conditions) { + if (condition->getType() == Condition::EventBase) + condition->connectEventBase(*this); } } void SVGSMILElement::disconnectEventBaseConditions() { - for (unsigned n = 0; n < m_conditions.size(); ++n) { - Condition* condition = m_conditions[n].get(); - if (condition->getType() == Condition::EventBase) { - ASSERT(!condition->syncBase()); - if (!condition->eventListener()) - continue; - // Note: It's a memory optimization to try to remove our condition - // event listener, but it's not guaranteed to work, since we have - // no guarantee that eventBaseFor() will be able to find our condition's - // original eventBase. So, we also have to disconnect ourselves from - // our condition event listener, in case it later fires. - SVGElement* eventBase = eventBaseFor(*condition); - if (eventBase) - eventBase->removeEventListener(AtomicString(condition->name()), - condition->eventListener(), false); - condition->eventListener()->disconnectAnimation(); - condition->setEventListener(nullptr); - } + for (Condition* condition : m_conditions) { + if (condition->getType() == Condition::EventBase) + condition->disconnectEventBase(*this); } } @@ -1183,26 +1189,25 @@ return; for (SVGSMILElement* element : m_syncBaseDependents) - element->createInstanceTimesFromSyncbase(this); + element->createInstanceTimesFromSyncbase(*this); loopBreaker.erase(this); } -void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) { +void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement& syncBase) { // FIXME: To be really correct, this should handle updating exising interval // by changing the associated times instead of creating new ones. - for (unsigned n = 0; n < m_conditions.size(); ++n) { - Condition* condition = m_conditions[n].get(); + for (Condition* condition : m_conditions) { if (condition->getType() == Condition::Syncbase && - condition->syncBase() == syncBase) { + condition->syncBaseEquals(syncBase)) { ASSERT(condition->name() == "begin" || condition->name() == "end"); // No nested time containers in SVG, no need for crazy time space // conversions. Phew! SMILTime time = 0; if (condition->name() == "begin") - time = syncBase->m_interval.begin + condition->offset(); + time = syncBase.m_interval.begin + condition->offset(); else - time = syncBase->m_interval.end + condition->offset(); + time = syncBase.m_interval.end + condition->offset(); if (!time.isFinite()) continue; SMILTime elapsed = this->elapsed(); @@ -1216,14 +1221,14 @@ } } -void SVGSMILElement::addSyncBaseDependent(SVGSMILElement* animation) { - m_syncBaseDependents.insert(animation); +void SVGSMILElement::addSyncBaseDependent(SVGSMILElement& animation) { + m_syncBaseDependents.insert(&animation); if (m_interval.begin.isFinite()) - animation->createInstanceTimesFromSyncbase(this); + animation.createInstanceTimesFromSyncbase(*this); } -void SVGSMILElement::removeSyncBaseDependent(SVGSMILElement* animation) { - m_syncBaseDependents.erase(animation); +void SVGSMILElement::removeSyncBaseDependent(SVGSMILElement& animation) { + m_syncBaseDependents.erase(&animation); } void SVGSMILElement::handleConditionEvent(Event* event, Condition* condition) { @@ -1302,13 +1307,6 @@ m_isScheduled = false; } -SVGSMILElement::Condition::~Condition() {} - -DEFINE_TRACE(SVGSMILElement::Condition) { - visitor->trace(m_syncBase); - visitor->trace(m_eventListener); -} - DEFINE_TRACE(SVGSMILElement) { visitor->trace(m_targetElement); visitor->trace(m_timeContainer);
diff --git a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h index 9a923568f..b89f404 100644 --- a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h +++ b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h
@@ -186,16 +186,10 @@ public: enum Type { EventBase, Syncbase, AccessKey }; - Condition(Type, - BeginOrEnd, - const String& baseID, - const String& name, - SMILTime offset, - int repeat = -1); static Condition* create(Type type, BeginOrEnd beginOrEnd, - const String& baseID, - const String& name, + const AtomicString& baseID, + const AtomicString& name, SMILTime offset, int repeat = -1) { return new Condition(type, beginOrEnd, baseID, name, offset, repeat); @@ -205,22 +199,33 @@ Type getType() const { return m_type; } BeginOrEnd getBeginOrEnd() const { return m_beginOrEnd; } - String baseID() const { return m_baseID; } - String name() const { return m_name; } + const AtomicString& name() const { return m_name; } SMILTime offset() const { return m_offset; } int repeat() const { return m_repeat; } - SVGSMILElement* syncBase() const { return m_syncBase.get(); } - void setSyncBase(SVGSMILElement* element) { m_syncBase = element; } - ConditionEventListener* eventListener() const { - return m_eventListener.get(); + + void connectSyncBase(SVGSMILElement&); + void disconnectSyncBase(SVGSMILElement&); + bool syncBaseEquals(SVGSMILElement& timedElement) const { + return m_syncBase == timedElement; } - void setEventListener(ConditionEventListener*); + + void connectEventBase(SVGSMILElement&); + void disconnectEventBase(SVGSMILElement&); private: + Condition(Type, + BeginOrEnd, + const AtomicString& baseID, + const AtomicString& name, + SMILTime offset, + int repeat); + + SVGElement* lookupEventBase(SVGSMILElement&) const; + Type m_type; BeginOrEnd m_beginOrEnd; - String m_baseID; - String m_name; + AtomicString m_baseID; + AtomicString m_name; SMILTime m_offset; int m_repeat; Member<SVGSMILElement> m_syncBase; @@ -228,7 +233,6 @@ }; bool parseCondition(const String&, BeginOrEnd beginOrEnd); void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd); - SVGElement* eventBaseFor(const Condition&); void disconnectSyncBaseConditions(); void disconnectEventBaseConditions(); @@ -237,9 +241,9 @@ void handleConditionEvent(Event*, Condition*); void notifyDependentsIntervalChanged(); - void createInstanceTimesFromSyncbase(SVGSMILElement* syncbase); - void addSyncBaseDependent(SVGSMILElement*); - void removeSyncBaseDependent(SVGSMILElement*); + void createInstanceTimesFromSyncbase(SVGSMILElement& syncbase); + void addSyncBaseDependent(SVGSMILElement&); + void removeSyncBaseDependent(SVGSMILElement&); enum ActiveState { Inactive, Active, Frozen };
diff --git a/third_party/WebKit/Source/devtools/.eslintrc.js b/third_party/WebKit/Source/devtools/.eslintrc.js index 914281a..869db2a 100644 --- a/third_party/WebKit/Source/devtools/.eslintrc.js +++ b/third_party/WebKit/Source/devtools/.eslintrc.js
@@ -42,6 +42,7 @@ "curly": [2, "multi-or-nest", "consistent"], "new-parens": 2, "func-call-spacing": 2, + "arrow-parens": [2, "as-needed"], // anti-patterns "no-with": 2,
diff --git a/third_party/WebKit/Source/devtools/front_end/Tests.js b/third_party/WebKit/Source/devtools/front_end/Tests.js index 21e7322..11a6be7 100644 --- a/third_party/WebKit/Source/devtools/front_end/Tests.js +++ b/third_party/WebKit/Source/devtools/front_end/Tests.js
@@ -866,8 +866,7 @@ TestSuite.prototype.testTempFile = function() { this.takeControl(); - Bindings.TempFile.create('test-file', 'test') - .then(() => this.releaseControl(), (error) => this.fail(String(error))); + Bindings.TempFile.create('test-file', 'test').then(() => this.releaseControl(), error => this.fail(String(error))); }; TestSuite.prototype.waitForTestResultsInConsole = function() {
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js index 22b2e09..7d7b8ea 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js
@@ -212,7 +212,7 @@ prefix = prefix.toLowerCase(); if (!prefix && !force && (this._isEditingName || expression)) return Promise.resolve([]); - return Promise.resolve(this._ariaCompletions.filter((value) => value.startsWith(prefix)).map(c => ({text: c}))); + return Promise.resolve(this._ariaCompletions.filter(value => value.startsWith(prefix)).map(c => ({text: c}))); } };
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js index 358aa53..1b5b1ec 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js
@@ -71,7 +71,7 @@ } else { // Only set the node for the accessibility panel, not the Elements tree. var axSidebarView = this._axSidebarView; - axNode.deferredDOMNode().resolve((node) => { + axNode.deferredDOMNode().resolve(node => { axSidebarView.setNode(node); }); } @@ -321,4 +321,3 @@ internalRole: 'ax-internal-role', role: 'ax-role', }; -
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js index e262c257..e15457e 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js
@@ -142,7 +142,7 @@ highlightDOMNode() { if (!this.isDOMNode()) return; - this.deferredDOMNode().resolvePromise().then((node) => { + this.deferredDOMNode().resolvePromise().then(node => { SDK.DOMModel.fromTarget(this.target()).nodeHighlightRequested(node.id); }); } @@ -180,7 +180,7 @@ if (!this._childIds || !this._childIds.length) return false; - return !this._childIds.some((id) => this._accessibilityModel.axNodeForId(id) !== undefined); + return !this._childIds.some(id => this._accessibilityModel.axNodeForId(id) !== undefined); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js b/third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js index 20cf7f5..71c203d 100644 --- a/third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js +++ b/third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js
@@ -142,7 +142,7 @@ if (!previousScriptState) return Promise.resolve(); - var hasBlackboxedMappings = sourceMap.sourceURLs().some((url) => this.isBlackboxedURL(url)); + var hasBlackboxedMappings = sourceMap.sourceURLs().some(url => this.isBlackboxedURL(url)); var mappings = hasBlackboxedMappings ? sourceMap.mappings().slice() : []; if (!mappings.length) { if (previousScriptState.length > 0)
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js b/third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js index 2a81701d..8940d93 100644 --- a/third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js +++ b/third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js
@@ -266,7 +266,7 @@ */ _reset(debuggerModel) { var modelData = this._debuggerModelToData.get(debuggerModel); - modelData.callFrameLocations.valuesArray().forEach((location) => this._removeLiveLocation(location)); + modelData.callFrameLocations.valuesArray().forEach(location => this._removeLiveLocation(location)); modelData.callFrameLocations.clear(); }
diff --git a/third_party/WebKit/Source/devtools/front_end/components/DOMPresentationUtils.js b/third_party/WebKit/Source/devtools/front_end/components/DOMPresentationUtils.js index 9e8c620..69a34727 100644 --- a/third_party/WebKit/Source/devtools/front_end/components/DOMPresentationUtils.js +++ b/third_party/WebKit/Source/devtools/front_end/components/DOMPresentationUtils.js
@@ -132,7 +132,7 @@ var link = shadowRoot.createChild('div', 'node-link'); link.createChild('content'); link.addEventListener('click', deferredNode.resolve.bind(deferredNode, onDeferredNodeResolved), false); - link.addEventListener('mousedown', (e) => e.consume(), false); + link.addEventListener('mousedown', e => e.consume(), false); /** * @param {?SDK.DOMNode} node
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js index 473a5f6..6bdf6b9 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js
@@ -196,8 +196,8 @@ var trace = propertyTraces.get(propertyName); if (trace) { var activeProperty = this._renderPropertyTrace(cssModel, matchedStyles, nodeStyle.node, treeElement, trace); - treeElement.listItemElement.addEventListener('mousedown', (e) => e.consume(), false); - treeElement.listItemElement.addEventListener('dblclick', (e) => e.consume(), false); + treeElement.listItemElement.addEventListener('mousedown', e => e.consume(), false); + treeElement.listItemElement.addEventListener('dblclick', e => e.consume(), false); treeElement.listItemElement.addEventListener('click', handleClick.bind(null, treeElement), false); var gotoSourceElement = UI.Icon.create('smallicon-arrow-in-circle', 'goto-source-icon'); gotoSourceElement.addEventListener('click', this._navigateToSource.bind(this, activeProperty));
diff --git a/third_party/WebKit/Source/devtools/front_end/inline_editor/ColorSwatch.js b/third_party/WebKit/Source/devtools/front_end/inline_editor/ColorSwatch.js index 823d9d7..54ef9ef2 100644 --- a/third_party/WebKit/Source/devtools/front_end/inline_editor/ColorSwatch.js +++ b/third_party/WebKit/Source/devtools/front_end/inline_editor/ColorSwatch.js
@@ -133,8 +133,8 @@ this._iconElement = root.createChild('span', 'color-swatch'); this._iconElement.title = Common.UIString('Shift-click to change color format'); this._swatchInner = this._iconElement.createChild('span', 'color-swatch-inner'); - this._swatchInner.addEventListener('dblclick', (e) => e.consume(), false); - this._swatchInner.addEventListener('mousedown', (e) => e.consume(), false); + this._swatchInner.addEventListener('dblclick', e => e.consume(), false); + this._swatchInner.addEventListener('mousedown', e => e.consume(), false); this._swatchInner.addEventListener('click', this._handleClick.bind(this), true); root.createChild('content');
diff --git a/third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js b/third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js index 60ef88f..b67ff4f 100644 --- a/third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js +++ b/third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js
@@ -10,7 +10,7 @@ this._popover = new UI.Popover(); this._popover.setCanShrink(false); this._popover.setNoPadding(true); - this._popover.element.addEventListener('mousedown', (e) => e.consume(), false); + this._popover.element.addEventListener('mousedown', e => e.consume(), false); this._hideProxy = this.hide.bind(this, true); this._boundOnKeyDown = this._onKeyDown.bind(this);
diff --git a/third_party/WebKit/Source/devtools/front_end/network/BlockedURLsPane.js b/third_party/WebKit/Source/devtools/front_end/network/BlockedURLsPane.js index e38c045..aa6445a 100644 --- a/third_party/WebKit/Source/devtools/front_end/network/BlockedURLsPane.js +++ b/third_party/WebKit/Source/devtools/front_end/network/BlockedURLsPane.js
@@ -16,7 +16,7 @@ this._blockedURLsSetting.addChangeListener(this._update, this); this._toolbar = new UI.Toolbar('', this.contentElement); - this._toolbar.element.addEventListener('click', (e) => e.consume()); + this._toolbar.element.addEventListener('click', e => e.consume()); var addButton = new UI.ToolbarButton(Common.UIString('Add pattern'), 'largeicon-add'); addButton.addEventListener(UI.ToolbarButton.Events.Click, this._addButtonClicked, this); this._toolbar.appendToolbarItem(addButton);
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js index 626ebe9..0fc88a5 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js
@@ -27,8 +27,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /** - * @implements {SDK.TargetManager.Observer} * @unrestricted */ Profiler.ProfileLauncherView = class extends UI.VBox { @@ -37,11 +37,8 @@ */ constructor(profilesPanel) { super(); - this._panel = profilesPanel; - - this.element.classList.add('profile-launcher-view'); - this.element.classList.add('panel-enabler-view'); + this.element.classList.add('profile-launcher-view', 'panel-enabler-view'); this._contentElement = this.element.createChild('div', 'profile-launcher-view-content'); this._innerContentElement = this._contentElement.createChild('div'); @@ -55,51 +52,13 @@ this._recordButtonEnabled = true; this._loadButton = UI.createTextButton(Common.UIString('Load'), this._loadButtonClicked.bind(this), 'load-profile'); this._contentElement.appendChild(this._loadButton); - SDK.targetManager.observeTargets(this); - } - /** - * @return {?UI.SearchableView} - */ - searchableView() { - return null; - } - - /** - * @override - * @param {!SDK.Target} target - */ - targetAdded(target) { - this._updateLoadButtonLayout(); - } - - /** - * @override - * @param {!SDK.Target} target - */ - targetRemoved(target) { - this._updateLoadButtonLayout(); - } - - _updateLoadButtonLayout() { - this._loadButton.classList.toggle('multi-target', SDK.targetManager.targets(SDK.Target.Capability.JS).length > 1); - } - - /** - * @param {!Profiler.ProfileType} profileType - */ - addProfileType(profileType) { - var descriptionElement = this._innerContentElement.createChild('h1'); - descriptionElement.textContent = profileType.description; - var decorationElement = profileType.decorationElement(); - if (decorationElement) - this._innerContentElement.appendChild(decorationElement); - this._isInstantProfile = profileType.isInstantProfile(); - this._isEnabled = profileType.isEnabled(); - } - - _controlButtonClicked() { - this._panel.toggleRecord(); + this._selectedProfileTypeSetting = Common.settings.createSetting('selectedProfileType', 'CPU'); + this._header = this._innerContentElement.createChild('h1'); + this._profileTypeSelectorForm = this._innerContentElement.createChild('form'); + this._innerContentElement.createChild('div', 'flexible-space'); + /** @type {!Map<string, !HTMLOptionElement>} */ + this._typeIdToOptionElement = new Map(); } _loadButtonClicked() { @@ -122,6 +81,8 @@ this._controlButton.classList.remove('running'); this._controlButton.textContent = Common.UIString('Start'); } + for (var item of this._typeIdToOptionElement.values()) + item.disabled = !!this._isProfiling; } profileStarted() { @@ -144,27 +105,8 @@ this._isEnabled = profileType.isEnabled(); this._updateControls(); } -}; - -/** - * @unrestricted - */ -Profiler.MultiProfileLauncherView = class extends Profiler.ProfileLauncherView { - /** - * @param {!Profiler.ProfilesPanel} profilesPanel - */ - constructor(profilesPanel) { - super(profilesPanel); - this._selectedProfileTypeSetting = Common.settings.createSetting('selectedProfileType', 'CPU'); - this._header = this._innerContentElement.createChild('h1'); - this._profileTypeSelectorForm = this._innerContentElement.createChild('form'); - this._innerContentElement.createChild('div', 'flexible-space'); - /** @type {!Map<string, !HTMLOptionElement>} */ - this._typeIdToOptionElement = new Map(); - } /** - * @override * @param {!Profiler.ProfileType} profileType */ addProfileType(profileType) { @@ -192,57 +134,26 @@ typeId = this._typeIdToOptionElement.keys().next().value; this._typeIdToOptionElement.get(typeId).checked = true; var type = this._typeIdToOptionElement.get(typeId)._profileType; - this.dispatchEventToListeners(Profiler.MultiProfileLauncherView.Events.ProfileTypeSelected, type); + this.dispatchEventToListeners(Profiler.ProfileLauncherView.Events.ProfileTypeSelected, type); } - /** - * @override - */ _controlButtonClicked() { this._panel.toggleRecord(); } /** - * @override - */ - _updateControls() { - super._updateControls(); - var items = this._profileTypeSelectorForm.elements; - for (var i = 0; i < items.length; ++i) { - if (items[i].type === 'radio') - items[i].disabled = this._isProfiling; - } - } - - /** * @param {!Profiler.ProfileType} profileType */ _profileTypeChanged(profileType) { - this.dispatchEventToListeners(Profiler.MultiProfileLauncherView.Events.ProfileTypeSelected, profileType); + this.dispatchEventToListeners(Profiler.ProfileLauncherView.Events.ProfileTypeSelected, profileType); this._isInstantProfile = profileType.isInstantProfile(); this._isEnabled = profileType.isEnabled(); this._updateControls(); this._selectedProfileTypeSetting.set(profileType.id); } - - /** - * @override - */ - profileStarted() { - this._isProfiling = true; - this._updateControls(); - } - - /** - * @override - */ - profileFinished() { - this._isProfiling = false; - this._updateControls(); - } }; /** @enum {symbol} */ -Profiler.MultiProfileLauncherView.Events = { +Profiler.ProfileLauncherView.Events = { ProfileTypeSelected: Symbol('ProfileTypeSelected') };
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js index 53ceb75..5829c1f 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
@@ -80,9 +80,9 @@ this._profileViewToolbar = new UI.Toolbar('', this._toolbarElement); this._profileGroups = {}; - this._launcherView = new Profiler.MultiProfileLauncherView(this); + this._launcherView = new Profiler.ProfileLauncherView(this); this._launcherView.addEventListener( - Profiler.MultiProfileLauncherView.Events.ProfileTypeSelected, this._onProfileTypeSelected, this); + Profiler.ProfileLauncherView.Events.ProfileTypeSelected, this._onProfileTypeSelected, this); this._profileToView = []; this._typeIdToSidebarSection = {};
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js index af55aa88..617b578a 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
@@ -13,6 +13,7 @@ this._reportView.show(this.contentElement); this._toolbar = this._reportView.createToolbar(); + this._toolbar.makeWrappable(false, true); /** @type {!Map<!SDK.ServiceWorkerRegistration, !Resources.ServiceWorkersView.Section>} */ this._sections = new Map(); @@ -28,9 +29,9 @@ var fallbackToNetwork = new UI.ToolbarSettingCheckbox( bypassServiceWorkerSetting, Common.UIString('Bypass Service Worker and load resources from the network')); this._toolbar.appendToolbarItem(fallbackToNetwork); - this._toolbar.appendSpacer(); this._showAllCheckbox = new UI.ToolbarCheckbox( Common.UIString('Show all'), Common.UIString('Show all Service Workers regardless of the origin')); + this._showAllCheckbox.setRightAligned(true); this._showAllCheckbox.inputElement.addEventListener('change', this._updateSectionVisibility.bind(this), false); this._toolbar.appendToolbarItem(this._showAllCheckbox);
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/Connections.js b/third_party/WebKit/Source/devtools/front_end/sdk/Connections.js index 06a0cfb..987f68a 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/Connections.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/Connections.js
@@ -117,7 +117,7 @@ this._socket = new WebSocket(url); this._socket.onerror = this._onError.bind(this); this._socket.onopen = this._onOpen.bind(this); - this._socket.onmessage = (messageEvent) => params.onMessage.call(null, /** @type {string} */ (messageEvent.data)); + this._socket.onmessage = messageEvent => params.onMessage.call(null, /** @type {string} */ (messageEvent.data)); this._socket.onclose = this._onClose.bind(this); this._onDisconnect = params.onDisconnect;
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js index a7645e0..8101ab0 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
@@ -374,10 +374,9 @@ return []; var mappings = this.mappings(); var info = this._sourceInfos.get(sourceURL); - if (info.reverseMappings === null) { - info.reverseMappings = - mappings.filter((mapping) => mapping.sourceURL === sourceURL).sort(sourceMappingComparator); - } + if (info.reverseMappings === null) + info.reverseMappings = mappings.filter(mapping => mapping.sourceURL === sourceURL).sort(sourceMappingComparator); + return info.reverseMappings; /**
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js index 9ab919f..9094d20 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
@@ -314,7 +314,7 @@ */ _observersForTarget(target) { return this._observers.filter( - (observer) => target.hasAllCapabilities(observer[this._observerCapabiliesMaskSymbol] || 0)); + observer => target.hasAllCapabilities(observer[this._observerCapabiliesMaskSymbol] || 0)); } /** @@ -354,7 +354,7 @@ if (!capabilitiesMask) return this._targets.slice(); else - return this._targets.filter((target) => target.hasAllCapabilities(capabilitiesMask || 0)); + return this._targets.filter(target => target.hasAllCapabilities(capabilitiesMask || 0)); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js index 6b477d6..69f172c 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js
@@ -112,10 +112,10 @@ SDK.DebuggerModel, SDK.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); SDK.targetManager.addModelListener( SDK.DebuggerModel, SDK.DebuggerModel.Events.DebuggerResumed, - (event) => this._debuggerResumed(/** @type {!SDK.DebuggerModel} */ (event.data))); + event => this._debuggerResumed(/** @type {!SDK.DebuggerModel} */ (event.data))); SDK.targetManager.addModelListener( SDK.DebuggerModel, SDK.DebuggerModel.Events.GlobalObjectCleared, - (event) => this._debuggerResumed(/** @type {!SDK.DebuggerModel} */ (event.data))); + event => this._debuggerResumed(/** @type {!SDK.DebuggerModel} */ (event.data))); SDK.targetManager.addModelListener( SDK.SubTargetsManager, SDK.SubTargetsManager.Events.AvailableNodeTargetsChanged, this._availableNodeTargetsChanged, this);
diff --git a/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js b/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js index bf1dff2..d270d6c 100644 --- a/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js +++ b/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js
@@ -9,9 +9,9 @@ TestRunner.executeTestScript = function() { fetch(`${Runtime.queryParam('test')}`) - .then((data) => data.text()) - .then((testScript) => eval(`(function(){${testScript}})()`)) - .catch((error) => { + .then(data => data.text()) + .then(testScript => eval(`(function(){${testScript}})()`)) + .catch(error => { TestRunner.addResult(`Unable to execute test script because of error: ${error}`); TestRunner.completeTest(); });
diff --git a/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js b/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js index ffd7f89..f0f76cf6 100644 --- a/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js +++ b/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js
@@ -90,7 +90,7 @@ _removeWordsFromText(text) { Common.TextUtils.textToWords( text, /** @type {function(string):boolean} */ (this._config.isWordChar), - (word) => this._dictionary.removeWord(word)); + word => this._dictionary.removeWord(word)); } /** @@ -126,7 +126,7 @@ var completions = this._dictionary.wordsWithPrefix(this._textEditor.text(queryRange)); var substituteWord = this._textEditor.text(substituteRange); if (this._dictionary.wordCount(substituteWord) === 1) - completions = completions.filter((word) => word !== substituteWord); + completions = completions.filter(word => word !== substituteWord); completions.sort((a, b) => this._dictionary.wordCount(b) - this._dictionary.wordCount(a) || a.length - b.length); return Promise.resolve(completions.map(item => ({text: item})));
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js index c257246..a7db0f4 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -802,7 +802,11 @@ } if (eventData['encodedDataLength']) { contentHelper.appendTextRow( - Common.UIString('Encoded Data Length'), Common.UIString('%d Bytes', eventData['encodedDataLength'])); + Common.UIString('Encoded Data'), Common.UIString('%d Bytes', eventData['encodedDataLength'])); + } + if (eventData['decodedBodyLength']) { + contentHelper.appendTextRow( + Common.UIString('Decoded Body'), Common.UIString('%d Bytes', eventData['decodedBodyLength'])); } break; case recordTypes.CompileScript: @@ -1100,12 +1104,14 @@ contentHelper.appendTextRow(Common.UIString('Mime Type'), request.mimeType); var lengthText = ''; if (request.fromCache) - lengthText += Common.UIString('(from cache) '); + lengthText += Common.UIString(' (from cache)'); if (request.fromServiceWorker) - lengthText += Common.UIString('(from service worker)'); + lengthText += Common.UIString(' (from service worker)'); if (request.encodedDataLength || !lengthText) - lengthText = `${Number.bytesToString(request.encodedDataLength)} ${lengthText}`; - contentHelper.appendTextRow(Common.UIString('Encoded Length'), lengthText); + lengthText = `${Number.bytesToString(request.encodedDataLength)}${lengthText}`; + contentHelper.appendTextRow(Common.UIString('Encoded Data'), lengthText); + if (request.decodedBodyLength) + contentHelper.appendTextRow(Common.UIString('Decoded Body'), Number.bytesToString(request.decodedBodyLength)); const title = Common.UIString('Initiator'); const sendRequest = request.children[0]; const topFrame = TimelineModel.TimelineData.forEvent(sendRequest).topFrame(); @@ -1967,7 +1973,7 @@ for (var i = 0; i < invalidations.length; i++) { var invalidation = invalidations[i]; var invalidationNode = this._createInvalidationNode(invalidation, false); - invalidationNode.addEventListener('click', (e) => e.consume(), false); + invalidationNode.addEventListener('click', e => e.consume(), false); if (invalidationNode && !invalidationNodeIdMap[invalidation.nodeId]) { invalidationNodes.push(invalidationNode); invalidationNodeIdMap[invalidation.nodeId] = true;
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js b/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js index b960a62..3980e42 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js
@@ -1289,6 +1289,7 @@ this.startTime = event.name === TimelineModel.TimelineModel.RecordType.ResourceSendRequest ? event.startTime : 0; this.endTime = Infinity; this.encodedDataLength = 0; + this.decodedBodyLength = 0; /** @type {!Array<!SDK.TracingModel.Event>} */ this.children = []; /** @type {?Object} */ @@ -1321,7 +1322,7 @@ if (!this.responseTime && (event.name === recordType.ResourceReceiveResponse || event.name === recordType.ResourceReceivedData)) this.responseTime = event.startTime; - const encodedDataLength = eventData['encodedDataLength'] || 0; + var encodedDataLength = eventData['encodedDataLength'] || 0; if (event.name === recordType.ResourceReceiveResponse) { if (eventData['fromCache']) this.fromCache = true; @@ -1333,6 +1334,9 @@ this.encodedDataLength += encodedDataLength; if (event.name === recordType.ResourceFinish && encodedDataLength) this.encodedDataLength = encodedDataLength; + var decodedBodyLength = eventData['decodedBodyLength']; + if (event.name === recordType.ResourceFinish && decodedBodyLength) + this.decodedBodyLength = decodedBodyLength; if (!this.url) this.url = eventData['url']; if (!this.requestMethod)
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js index ed7e23c..1f905c9 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
@@ -61,7 +61,7 @@ this.element.style.left = (this._parentMenu ? x - subMenuOverlap : x) + 'px'; this._contextMenuElement.tabIndex = 0; - this._contextMenuElement.addEventListener('mouseup', (e) => e.consume(), false); + this._contextMenuElement.addEventListener('mouseup', e => e.consume(), false); this._contextMenuElement.addEventListener('keydown', this._menuKeyDown.bind(this), false); for (var i = 0; i < this._items.length; ++i)
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js index 1607fe6..75ed17ce 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -194,12 +194,15 @@ /** * @param {boolean=} reverse + * @param {boolean=} growVertically */ - makeWrappable(reverse) { + makeWrappable(reverse, growVertically) { this._contentElement.classList.add('wrappable'); this._reverse = !!reverse; if (reverse) this._contentElement.classList.add('wrappable-reverse'); + if (growVertically) + this._contentElement.classList.add('toolbar-grow-vertical'); } makeVertical() { @@ -429,6 +432,10 @@ if (this._toolbar && !(this instanceof UI.ToolbarSeparator)) this._toolbar._hideSeparatorDupes(); } + + setRightAligned(alignRight) { + this.element.classList.toggle('toolbar-item-right-aligned', alignRight); + } }; /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js index 549939c6..edef869 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -1942,7 +1942,7 @@ a.href = href; a.classList.add('devtools-link'); if (!preventClick) { - a.addEventListener('click', (event) => { + a.addEventListener('click', event => { event.consume(true); InspectorFrontendHost.openInNewTab(/** @type {string} */ (href)); }, false);
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css b/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css index 64e0597..b59a274 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css +++ b/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css
@@ -28,6 +28,10 @@ flex-direction: row-reverse; } +.toolbar-shadow.toolbar-grow-vertical { + height: initial; +} + .toolbar-shadow.vertical { flex-direction: column; height: auto;
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp b/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp index 44f9ad9..8fc5a02 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
@@ -69,7 +69,10 @@ m_failureCallback(std::move(failure)) {} // ContentDecryptionModuleResult implementation. - void complete() override { (*m_successCallback)(); } + void complete() override { + DVLOG(EME_LOG_LEVEL) << __func__ << ": promise resolved."; + (*m_successCallback)(); + } void completeWithContentDecryptionModule( WebContentDecryptionModule*) override { @@ -98,6 +101,9 @@ result.append(')'); } + DVLOG(EME_LOG_LEVEL) << __func__ << ": promise rejected with code " << code + << " and message: " << result.toString(); + (*m_failureCallback)(WebCdmExceptionToExceptionCode(code), result.toString()); } @@ -338,7 +344,7 @@ MediaKeys* mediaKeys) { HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia::from(element); - DVLOG(EME_LOG_LEVEL) << __func__ << " current(" + DVLOG(EME_LOG_LEVEL) << __func__ << ": current(" << thisElement.m_mediaKeys.get() << "), new(" << mediaKeys << ")";
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp index 108b256..cc8f103 100644 --- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp +++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -262,7 +262,7 @@ // If what we were given has an invalid source, need to exit fullscreen with // previous, valid source, so delay m_layer reassignment - if (!layers[0].source()) { + if (layers[0].source().isNull()) { forceExitPresent(); DOMException* exception = DOMException::create(InvalidStateError, "Invalid layer source."); @@ -272,8 +272,15 @@ } m_layer = layers[0]; - CanvasRenderingContext* renderingContext = - m_layer.source()->renderingContext(); + CanvasRenderingContext* renderingContext; + if (m_layer.source().isHTMLCanvasElement()) { + renderingContext = + m_layer.source().getAsHTMLCanvasElement()->renderingContext(); + } else { + DCHECK(m_layer.source().isOffscreenCanvas()); + renderingContext = + m_layer.source().getAsOffscreenCanvas()->renderingContext(); + } if (!renderingContext || !renderingContext->is3d()) { forceExitPresent(); @@ -387,48 +394,65 @@ PresentationResult::PresentationNotSupportedByDisplay); return; } else { - // TODO(klausw,crbug.com/655722): Need a proper VR compositor, but - // for the moment on mobile we'll just make the canvas fullscreen - // so that VrShell can pick it up through the standard (high - // latency) compositing path. - auto canvas = m_layer.source(); - auto inlineStyle = canvas->inlineStyle(); - if (inlineStyle) { - // THREE.js's VREffect sets explicit style.width/height on its rendering - // canvas based on the non-fullscreen window dimensions, and it keeps - // those unchanged when presenting. Unfortunately it appears that a - // fullscreened canvas just gets centered if it has explicitly set a - // size smaller than the fullscreen dimensions. Manually set size to - // 100% in this case and restore it when exiting fullscreen. This is a - // stopgap measure since THREE.js's usage appears legal according to the - // WebVR API spec. This will no longer be necessary once we can get rid - // of this fullscreen hack. - m_fullscreenOrigWidth = inlineStyle->getPropertyValue(CSSPropertyWidth); - if (!m_fullscreenOrigWidth.isNull()) { - canvas->setInlineStyleProperty(CSSPropertyWidth, "100%"); + if (m_layer.source().isHTMLCanvasElement()) { + HTMLCanvasElement* canvas = m_layer.source().getAsHTMLCanvasElement(); + // TODO(klausw,crbug.com/655722): Need a proper VR compositor, but + // for the moment on mobile we'll just make the canvas fullscreen + // so that VrShell can pick it up through the standard (high + // latency) compositing path. auto canvas = + // m_layer.source().getAsHTMLCanvasElement(); + auto inlineStyle = canvas->inlineStyle(); + if (inlineStyle) { + // THREE.js's VREffect sets explicit style.width/height on its rendering + // canvas based on the non-fullscreen window dimensions, and it keeps + // those unchanged when presenting. Unfortunately it appears that a + // fullscreened canvas just gets centered if it has explicitly set a + // size smaller than the fullscreen dimensions. Manually set size to + // 100% in this case and restore it when exiting fullscreen. This is a + // stopgap measure since THREE.js's usage appears legal according to the + // WebVR API spec. This will no longer be necessary once we can get rid + // of this fullscreen hack. + m_fullscreenOrigWidth = inlineStyle->getPropertyValue(CSSPropertyWidth); + if (!m_fullscreenOrigWidth.isNull()) { + canvas->setInlineStyleProperty(CSSPropertyWidth, "100%"); + } + m_fullscreenOrigHeight = + inlineStyle->getPropertyValue(CSSPropertyHeight); + if (!m_fullscreenOrigHeight.isNull()) { + canvas->setInlineStyleProperty(CSSPropertyHeight, "100%"); + } + } else { + m_fullscreenOrigWidth = String(); + m_fullscreenOrigHeight = String(); } - m_fullscreenOrigHeight = inlineStyle->getPropertyValue(CSSPropertyHeight); - if (!m_fullscreenOrigHeight.isNull()) { - canvas->setInlineStyleProperty(CSSPropertyHeight, "100%"); + + if (doc) { + // Since the callback for requestPresent is asynchronous, we've lost our + // UserGestureToken, and need to create a new one to enter fullscreen. + gestureIndicator = WTF::wrapUnique( + new UserGestureIndicator(DocumentUserGestureToken::create( + doc, UserGestureToken::Status::PossiblyExistingGesture))); } + Fullscreen::requestFullscreen(*canvas); + + // Check to see if the canvas is still the current fullscreen + // element once every 2 seconds. + m_fullscreenCheckTimer.startRepeating(2.0, BLINK_FROM_HERE); + m_reenteredFullscreen = false; } else { - m_fullscreenOrigWidth = String(); - m_fullscreenOrigHeight = String(); + DCHECK(m_layer.source().isOffscreenCanvas()); + // TODO(junov, crbug.com/695497): Implement OffscreenCanvas presentation + forceExitPresent(); + DOMException* exception = DOMException::create( + InvalidStateError, "OffscreenCanvas presentation not implemented."); + while (!m_pendingPresentResolvers.isEmpty()) { + ScriptPromiseResolver* resolver = m_pendingPresentResolvers.takeFirst(); + resolver->reject(exception); + } + ReportPresentationResult( + PresentationResult::PresentationNotSupportedByDisplay); + return; } - - if (doc) { - // Since the callback for requestPresent is asynchronous, we've lost our - // UserGestureToken, and need to create a new one to enter fullscreen. - gestureIndicator = WTF::wrapUnique( - new UserGestureIndicator(DocumentUserGestureToken::create( - doc, UserGestureToken::Status::PossiblyExistingGesture))); - } - Fullscreen::requestFullscreen(*canvas); - - // Check to see if the canvas is still the current fullscreen - // element once every 2 seconds. - m_fullscreenCheckTimer.startRepeating(2.0, BLINK_FROM_HERE); - m_reenteredFullscreen = false; } if (doc) { @@ -611,17 +635,22 @@ void VRDisplay::stopPresenting() { if (m_isPresenting) { if (!m_capabilities->hasExternalDisplay()) { - auto canvas = m_layer.source(); - Fullscreen::fullyExitFullscreen(canvas->document()); - m_fullscreenCheckTimer.stop(); - if (!m_fullscreenOrigWidth.isNull()) { - canvas->setInlineStyleProperty(CSSPropertyWidth, m_fullscreenOrigWidth); - m_fullscreenOrigWidth = String(); - } - if (!m_fullscreenOrigHeight.isNull()) { - canvas->setInlineStyleProperty(CSSPropertyWidth, - m_fullscreenOrigHeight); - m_fullscreenOrigHeight = String(); + if (m_layer.source().isHTMLCanvasElement()) { + auto canvas = m_layer.source().getAsHTMLCanvasElement(); + Fullscreen::fullyExitFullscreen(canvas->document()); + m_fullscreenCheckTimer.stop(); + if (!m_fullscreenOrigWidth.isNull()) { + canvas->setInlineStyleProperty(CSSPropertyWidth, + m_fullscreenOrigWidth); + m_fullscreenOrigWidth = String(); + } + if (!m_fullscreenOrigHeight.isNull()) { + canvas->setInlineStyleProperty(CSSPropertyWidth, + m_fullscreenOrigHeight); + m_fullscreenOrigHeight = String(); + } + } else { + // TODO(junov, crbug.com/695497): Implement for OffscreenCanvas } } else { // Can't get into this presentation mode, so nothing to do here. @@ -695,6 +724,7 @@ } void VRDisplay::onFullscreenCheck(TimerBase*) { + DCHECK(m_layer.source().isHTMLCanvasElement()); if (!m_isPresenting) { m_fullscreenCheckTimer.stop(); return; @@ -704,7 +734,8 @@ // depend on the Fullscreen API to fake VR presentation, so this will // become unnessecary. Until that point, though, this seems preferable to // adding a bunch of notification plumbing to Fullscreen. - if (!Fullscreen::isCurrentFullScreenElement(*m_layer.source())) { + if (!Fullscreen::isCurrentFullScreenElement( + *m_layer.source().getAsHTMLCanvasElement())) { // TODO(mthiesse): Due to asynchronous resizing, we might get kicked out of // fullscreen when changing display parameters upon entering WebVR. So one // time only, we reenter fullscreen after having left it; otherwise we exit @@ -718,7 +749,7 @@ return; } m_reenteredFullscreen = true; - auto canvas = m_layer.source(); + auto canvas = m_layer.source().getAsHTMLCanvasElement(); Document* doc = this->document(); std::unique_ptr<UserGestureIndicator> gestureIndicator; if (doc) {
diff --git a/third_party/WebKit/Source/modules/vr/VRLayer.idl b/third_party/WebKit/Source/modules/vr/VRLayer.idl index 6bf2a70..3fab721 100644 --- a/third_party/WebKit/Source/modules/vr/VRLayer.idl +++ b/third_party/WebKit/Source/modules/vr/VRLayer.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -typedef HTMLCanvasElement VRSource; +typedef (HTMLCanvasElement or OffscreenCanvas) VRSource; // https://w3c.github.io/webvr/#interface-vrlayer
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn index ef1a3e35..0a638a3 100644 --- a/third_party/WebKit/Source/platform/BUILD.gn +++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -1063,6 +1063,8 @@ "mac/BlockExceptions.mm", "mac/ColorMac.h", "mac/ColorMac.mm", + "mac/GraphicsContextCanvas.h", + "mac/GraphicsContextCanvas.mm", "mac/KillRingMac.mm", "mac/LocalCurrentGraphicsContext.h", "mac/LocalCurrentGraphicsContext.mm", @@ -1752,6 +1754,7 @@ "loader/fetch/ResourceFetcherTest.cpp", "loader/fetch/ResourceLoaderOptionsTest.cpp", "loader/fetch/ResourceTest.cpp", + "mac/GraphicsContextCanvasTest.mm", "mac/VersionUtilMacTest.mm", "mojo/CommonCustomTypesStructTraitsTest.cpp", "mojo/GeometryStructTraitsTest.cpp",
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintCanvas.h b/third_party/WebKit/Source/platform/graphics/paint/PaintCanvas.h index 4d942ab..c31f9ea 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintCanvas.h +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintCanvas.h
@@ -11,6 +11,7 @@ using cc::PaintCanvas; using cc::PaintCanvasAutoRestore; using cc::PaintCanvasPassThrough; +using cc::ToPixmap; } #endif // PaintCanvas_h
diff --git a/third_party/WebKit/Source/platform/loader/fetch/FetchContext.cpp b/third_party/WebKit/Source/platform/loader/fetch/FetchContext.cpp index 5f29873..00b0a35 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/FetchContext.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/FetchContext.cpp
@@ -80,7 +80,10 @@ void FetchContext::dispatchDidDownloadData(unsigned long, int, int) {} -void FetchContext::dispatchDidFinishLoading(unsigned long, double, int64_t) {} +void FetchContext::dispatchDidFinishLoading(unsigned long, + double, + int64_t, + int64_t) {} void FetchContext::dispatchDidFail(unsigned long, const ResourceError&,
diff --git a/third_party/WebKit/Source/platform/loader/fetch/FetchContext.h b/third_party/WebKit/Source/platform/loader/fetch/FetchContext.h index 1c42354a..8c92022 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/FetchContext.h +++ b/third_party/WebKit/Source/platform/loader/fetch/FetchContext.h
@@ -115,7 +115,8 @@ int encodedDataLength); virtual void dispatchDidFinishLoading(unsigned long identifier, double finishTime, - int64_t encodedDataLength); + int64_t encodedDataLength, + int64_t decodedBodyLength); virtual void dispatchDidFail(unsigned long identifier, const ResourceError&, int64_t encodedDataLength,
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp index d62e6a12..eae214e 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -1197,7 +1197,8 @@ } context().dispatchDidFinishLoading(resource->identifier(), finishTime, - encodedDataLength); + encodedDataLength, + resource->response().decodedBodyLength()); if (type == DidFinishLoading) resource->finish(finishTime);
diff --git a/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.h b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.h new file mode 100644 index 0000000..f90335f3 --- /dev/null +++ b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.h
@@ -0,0 +1,61 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef GraphicsContextCanvas_h +#define GraphicsContextCanvas_h + +#include <ApplicationServices/ApplicationServices.h> + +#include "platform/PlatformExport.h" +#include "platform/graphics/paint/PaintCanvas.h" +#include "third_party/skia/include/core/SkBitmap.h" + +struct SkIRect; + +namespace blink { + +// Converts a PaintCanvas temporarily to a CGContext +class PLATFORM_EXPORT GraphicsContextCanvas { + public: + /** + User clip rect is an *additional* clip to be applied in addition to the + current state of the canvas, in *local* rather than device coordinates. + If no additional clipping is desired, pass in + SkIRect::MakeSize(canvas->getBaseLayerSize()) transformed by the inverse + CTM. + */ + GraphicsContextCanvas(PaintCanvas*, + const SkIRect& userClipRect, + SkScalar bitmapScaleFactor = 1); + ~GraphicsContextCanvas(); + CGContextRef cgContext(); + bool hasEmptyClipRegion() const; + + private: + void releaseIfNeeded(); + SkIRect computeDirtyRect(); + + PaintCanvas* m_canvas; + + CGContextRef m_cgContext; + // m_offscreen is only valid if m_useDeviceBits is false + SkBitmap m_offscreen; + SkIPoint m_bitmapOffset; + SkScalar m_bitmapScaleFactor; + + // True if we are drawing to |m_canvas|'s backing store directly. + // Otherwise, the bits in |bitmap_| are our allocation and need to + // be copied over to |m_canvas|. + bool m_useDeviceBits; + + // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating + // a non-null CGContext (it is invalid to use a null CGContext), and will not + // be copied to |m_canvas|. This will happen if |m_canvas|'s clip region is + // empty. + bool m_bitmapIsDummy; +}; + +} // namespace blink + +#endif // GraphicsContextCanvas_h
diff --git a/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm new file mode 100644 index 0000000..f45ac090 --- /dev/null +++ b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm
@@ -0,0 +1,137 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "platform/mac/GraphicsContextCanvas.h" + +#import <AppKit/AppKit.h> +#import <CoreGraphics/CoreGraphics.h> + +#include "skia/ext/skia_utils_mac.h" +#include "wtf/RetainPtr.h" + +namespace blink { + +GraphicsContextCanvas::GraphicsContextCanvas(PaintCanvas* canvas, + const SkIRect& userClipRect, + SkScalar bitmapScaleFactor) + : m_canvas(canvas), + m_cgContext(0), + m_bitmapScaleFactor(bitmapScaleFactor), + m_useDeviceBits(false), + m_bitmapIsDummy(false) { + m_canvas->save(); + m_canvas->clipRect(SkRect::MakeFromIRect(userClipRect)); +} + +GraphicsContextCanvas::~GraphicsContextCanvas() { + releaseIfNeeded(); + m_canvas->restore(); +} + +SkIRect GraphicsContextCanvas::computeDirtyRect() { + // If the user specified a clip region, assume that it was tight and that the + // dirty rect is approximately the whole bitmap. + return SkIRect::MakeWH(m_offscreen.width(), m_offscreen.height()); +} + +// This must be called to balance calls to cgContext +void GraphicsContextCanvas::releaseIfNeeded() { + if (!m_cgContext) + return; + if (!m_useDeviceBits && !m_bitmapIsDummy) { + // Find the bits that were drawn to. + SkIRect bounds = computeDirtyRect(); + SkBitmap subset; + if (!m_offscreen.extractSubset(&subset, bounds)) { + return; + } + subset.setImmutable(); // Prevents a defensive copy inside Skia. + m_canvas->save(); + m_canvas->setMatrix(SkMatrix::I()); // Reset back to device space. + m_canvas->translate(bounds.x() + m_bitmapOffset.x(), + bounds.y() + m_bitmapOffset.y()); + m_canvas->scale(1.f / m_bitmapScaleFactor, 1.f / m_bitmapScaleFactor); + m_canvas->drawBitmap(subset, 0, 0); + m_canvas->restore(); + } + CGContextRelease(m_cgContext); + m_cgContext = 0; + m_useDeviceBits = false; + m_bitmapIsDummy = false; +} + +CGContextRef GraphicsContextCanvas::cgContext() { + releaseIfNeeded(); // This flushes any prior bitmap use + + SkIRect clip_bounds; + if (!m_canvas->getDeviceClipBounds(&clip_bounds)) { + // If the clip is empty, then there is nothing to draw. The caller may + // attempt to draw (to-be-clipped) results, so ensure there is a dummy + // non-NULL CGContext to use. + m_bitmapIsDummy = true; + clip_bounds = SkIRect::MakeXYWH(0, 0, 1, 1); + } + + // remember the top/left, in case we need to compose this later + m_bitmapOffset.set(clip_bounds.x(), clip_bounds.y()); + + // Now make clip_bounds be relative to the current layer/device + if (!m_bitmapIsDummy) { + m_canvas->temporary_internal_describeTopLayer(nullptr, &clip_bounds); + } + + SkPixmap devicePixels; + ToPixmap(m_canvas, &devicePixels); + + // Only draw directly if we have pixels, and we're only rect-clipped. + // If not, we allocate an offscreen and draw into that, relying on the + // compositing step to apply skia's clip. + m_useDeviceBits = + devicePixels.addr() && m_canvas->isClipRect() && !m_bitmapIsDummy; + WTF::RetainPtr<CGColorSpace> colorSpace(CGColorSpaceCreateDeviceRGB()); + + int displayHeight; + if (m_useDeviceBits) { + SkPixmap subset; + bool result = devicePixels.extractSubset(&subset, clip_bounds); + DCHECK(result); + if (!result) + return 0; + displayHeight = subset.height(); + m_cgContext = CGBitmapContextCreate( + subset.writable_addr(), subset.width(), subset.height(), 8, + subset.rowBytes(), colorSpace.get(), + kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); + } else { + bool result = m_offscreen.tryAllocN32Pixels( + SkScalarCeilToInt(m_bitmapScaleFactor * clip_bounds.width()), + SkScalarCeilToInt(m_bitmapScaleFactor * clip_bounds.height())); + DCHECK(result); + if (!result) + return 0; + m_offscreen.eraseColor(0); + displayHeight = m_offscreen.height(); + m_cgContext = CGBitmapContextCreate( + m_offscreen.getPixels(), m_offscreen.width(), m_offscreen.height(), 8, + m_offscreen.rowBytes(), colorSpace.get(), + kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); + } + DCHECK(m_cgContext); + + SkMatrix matrix = m_canvas->getTotalMatrix(); + matrix.postTranslate(-SkIntToScalar(m_bitmapOffset.x()), + -SkIntToScalar(m_bitmapOffset.y())); + matrix.postScale(m_bitmapScaleFactor, -m_bitmapScaleFactor); + matrix.postTranslate(0, SkIntToScalar(displayHeight)); + + CGContextConcatCTM(m_cgContext, skia::SkMatrixToCGAffineTransform(matrix)); + + return m_cgContext; +} + +bool GraphicsContextCanvas::hasEmptyClipRegion() const { + return m_canvas->isClipEmpty(); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/platform/mac/GraphicsContextCanvasTest.mm b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvasTest.mm new file mode 100644 index 0000000..da375d2 --- /dev/null +++ b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvasTest.mm
@@ -0,0 +1,75 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "platform/mac/GraphicsContextCanvas.h" +#include "skia/ext/skia_utils_mac.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace blink { + +enum TestType { + TestIdentity = 0, + TestTranslate = 1, + TestClip = 2, + TestXClip = TestTranslate | TestClip, +}; + +void RunTest(TestType test) { + const unsigned width = 2; + const unsigned height = 2; + const unsigned storageSize = width * height; + const unsigned original[] = {0xFF333333, 0xFF666666, 0xFF999999, 0xFFCCCCCC}; + EXPECT_EQ(storageSize, sizeof(original) / sizeof(original[0])); + unsigned bits[storageSize]; + memcpy(bits, original, sizeof(original)); + SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); + SkBitmap bitmap; + bitmap.installPixels(info, bits, info.minRowBytes()); + + PaintCanvas canvas(bitmap); + if (test & TestTranslate) + canvas.translate(width / 2, 0); + if (test & TestClip) { + SkRect clipRect = {0, height / 2, width, height}; + canvas.clipRect(clipRect); + } + { + SkIRect clip = + SkIRect::MakeSize(canvas.getBaseLayerSize()) + .makeOffset( + (test & TestTranslate) ? -(static_cast<int>(width)) / 2 : 0, 0); + GraphicsContextCanvas bitLocker(&canvas, clip); + CGContextRef cgContext = bitLocker.cgContext(); + CGColorRef testColor = CGColorGetConstantColor(kCGColorWhite); + CGContextSetFillColorWithColor(cgContext, testColor); + CGRect cgRect = {{0, 0}, {width, height}}; + CGContextFillRect(cgContext, cgRect); + } + const unsigned results[][storageSize] = { + {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}, // identity + {0xFF333333, 0xFFFFFFFF, 0xFF999999, 0xFFFFFFFF}, // translate + {0xFF333333, 0xFF666666, 0xFFFFFFFF, 0xFFFFFFFF}, // clip + {0xFF333333, 0xFF666666, 0xFF999999, 0xFFFFFFFF} // translate | clip + }; + for (unsigned index = 0; index < storageSize; index++) + EXPECT_EQ(results[test][index], bits[index]); +} + +TEST(GraphicsContextCanvasTest, Identity) { + RunTest(TestIdentity); +} + +TEST(GraphicsContextCanvasTest, Translate) { + RunTest(TestTranslate); +} + +TEST(GraphicsContextCanvasTest, Clip) { + RunTest(TestClip); +} + +TEST(GraphicsContextCanvasTest, XClip) { + RunTest(TestXClip); +} + +} // namespace
diff --git a/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.h b/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.h index bfdeffa..72699bfe 100644 --- a/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.h +++ b/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.h
@@ -20,7 +20,7 @@ #include "platform/PlatformExport.h" #include "platform/geometry/IntRect.h" #include "platform/graphics/paint/PaintCanvas.h" -#include "skia/ext/skia_utils_mac.h" +#include "platform/mac/GraphicsContextCanvas.h" #include "wtf/Noncopyable.h" OBJC_CLASS NSGraphicsContext; @@ -47,6 +47,6 @@ NSGraphicsContext* m_savedNSGraphicsContext; bool m_didSetGraphicsContext; IntRect m_inflatedDirtyRect; - skia::SkiaBitLocker m_skiaBitLocker; + GraphicsContextCanvas m_graphicsContextCanvas; }; }
diff --git a/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm b/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm index 39925f7a..1677c43 100644 --- a/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm +++ b/third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm
@@ -49,7 +49,7 @@ const IntRect& dirtyRect) : m_didSetGraphicsContext(false), m_inflatedDirtyRect(ThemeMac::inflateRectForAA(dirtyRect)), - m_skiaBitLocker(canvas, m_inflatedDirtyRect, deviceScaleFactor) { + m_graphicsContextCanvas(canvas, m_inflatedDirtyRect, deviceScaleFactor) { m_savedCanvas = canvas; canvas->save(); @@ -87,7 +87,7 @@ CGContextRef LocalCurrentGraphicsContext::cgContext() { // This synchronizes the CGContext to reflect the current SkCanvas state. // The implementation may not return the same CGContext each time. - CGContextRef cgContext = m_skiaBitLocker.cgContext(); + CGContextRef cgContext = m_graphicsContextCanvas.cgContext(); return cgContext; }
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py index 0dce4c6..34b80cd 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py
@@ -16,24 +16,16 @@ _log = logging.getLogger(__name__) -_COMMANDS_THAT_REQUIRE_AUTH = ( - 'archive', 'comments', 'commit', 'description', 'diff', 'land', 'lint', 'owners', 'patch', - 'presubmit', 'set-close', 'set-commit', 'status', 'try-results', 'try', 'upload', -) - class GitCL(object): - def __init__(self, host, auth_refresh_token_json=None, cwd=None): + def __init__(self, host, cwd=None): self._host = host - self._auth_refresh_token_json = auth_refresh_token_json self._cwd = cwd def run(self, args): """Runs git-cl with the given arguments and returns the output.""" command = ['git', 'cl'] + args - if self._auth_refresh_token_json and args[0] in _COMMANDS_THAT_REQUIRE_AUTH: - command += ['--auth-refresh-token-json', self._auth_refresh_token_json] return self._host.executive.run_command(command, cwd=self._cwd) def get_issue_number(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py index c67909e..b30bccdc 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py
@@ -20,21 +20,12 @@ self.assertEqual(output, 'mock-output') self.assertEqual(host.executive.calls, [['git', 'cl', 'command']]) - def test_run_with_auth(self): + def test_run_basic(self): host = MockHost() host.executive = MockExecutive(output='mock-output') - git_cl = GitCL(host, auth_refresh_token_json='token.json') + git_cl = GitCL(host) git_cl.run(['upload']) - self.assertEqual( - host.executive.calls, - [['git', 'cl', 'upload', '--auth-refresh-token-json', 'token.json']]) - - def test_some_commands_not_run_with_auth(self): - host = MockHost() - host.executive = MockExecutive(output='mock-output') - git_cl = GitCL(host, auth_refresh_token_json='token.json') - git_cl.run(['issue']) - self.assertEqual(host.executive.calls, [['git', 'cl', 'issue']]) + self.assertEqual(host.executive.calls, [['git', 'cl', 'upload']]) def test_get_issue_number(self): host = MockHost()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld.py deleted file mode 100644 index c1438fa..0000000 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld.py +++ /dev/null
@@ -1,100 +0,0 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Utility functions to communicate with Rietveld.""" - -import json -import logging -import urllib2 - -from webkitpy.common.net.buildbot import Build, filter_latest_builds - -_log = logging.getLogger(__name__) - -BASE_CODEREVIEW_URL = 'https://codereview.chromium.org/api' - - -class Rietveld(object): - - def __init__(self, web): - self.web = web - - def latest_try_jobs(self, issue_number, builder_names=None, patchset_number=None): - """Returns a list of Build objects for builds on the latest patchset. - - Args: - issue_number: A Rietveld issue number. - builder_names: A collection of builder names. If specified, only results - from the given list of builders will be kept. - patchset_number: If given, a specific patchset will be used instead of the latest one. - - Returns: - A list of Build objects, where Build objects for completed jobs have a build number, - and Build objects for pending jobs have no build number. - """ - try: - if patchset_number: - url = self._patchset_url(issue_number, patchset_number) - else: - url = self._latest_patchset_url(issue_number) - patchset_data = self._get_json(url) - except (urllib2.URLError, ValueError): - return [] - - builds = [] - for result_dict in patchset_data['try_job_results']: - build = Build(result_dict['builder'], result_dict['buildnumber']) - # Normally, a value of -1 or 6 in the "result" field indicates the job is - # started or pending, and the "buildnumber" field is null. - if build.build_number and result_dict['result'] in (-1, 6): - _log.warning('Build %s has result %d, but unexpectedly has a build number.', build, result_dict['result']) - build.build_number = None - builds.append(build) - - if builder_names is not None: - builds = [b for b in builds if b.builder_name in builder_names] - - return filter_latest_builds(builds) - - def changed_files(self, issue_number): - """Lists the files included in a CL that are changed but not deleted. - - File paths are sorted and relative to the repository root. - """ - try: - url = self._latest_patchset_url(issue_number) - issue_data = self._get_json(url) - return sorted(path for path, file_change in issue_data['files'].iteritems() if file_change['status'] != 'D') - except (urllib2.URLError, ValueError, KeyError): - _log.warning('Failed to list changed files for issue %s.', issue_number) - return None - - def _latest_patchset_url(self, issue_number): - issue_data = self._get_json(self._issue_url(issue_number)) - latest_patchset_number = issue_data["patchsets"][-1] - return self._patchset_url(issue_number, latest_patchset_number) - - def _get_json(self, url): - """Fetches JSON from a URL, and logs errors if the request was unsuccessful. - - Raises: - urllib2.URLError: Something went wrong with the request. - ValueError: The response wasn't valid JSON. - """ - try: - contents = self.web.get_binary(url) - except urllib2.URLError: - _log.error('Request failed to URL: %s', url) - raise - try: - return json.loads(contents) - except ValueError: - _log.error('Invalid JSON: %s', contents) - raise - - def _issue_url(self, issue_number): - return '%s/%s' % (BASE_CODEREVIEW_URL, issue_number) - - def _patchset_url(self, issue_number, patchset_number): - return '%s/%s' % (self._issue_url(issue_number), patchset_number)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld_unittest.py deleted file mode 100644 index 8f39a5bd..0000000 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld_unittest.py +++ /dev/null
@@ -1,95 +0,0 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import json -import urllib2 - -from webkitpy.common.net.rietveld import Rietveld -from webkitpy.common.net.buildbot import Build -from webkitpy.common.net.web_mock import MockWeb -from webkitpy.common.system.log_testing import LoggingTestCase - - -class RietveldTest(LoggingTestCase): - - def mock_web(self): - return MockWeb(urls={ - 'https://codereview.chromium.org/api/11112222': json.dumps({ - 'patchsets': [1, 2, 3], - }), - 'https://codereview.chromium.org/api/11112222/2': json.dumps({ - 'try_job_results': [ - { - 'builder': 'foo-builder', - 'buildnumber': None, - 'result': -1 - }, - { - 'builder': 'bar-builder', - 'buildnumber': 50, - 'result': 0 - }, - ], - }), - 'https://codereview.chromium.org/api/11112222/3': json.dumps({ - 'try_job_results': [ - { - 'builder': 'foo-builder', - 'buildnumber': 20, - 'result': 1 - }, - { - 'builder': 'bar-builder', - 'buildnumber': 60, - 'result': 0 - }, - ], - 'files': { - 'some/path/foo.cc': {'status': 'M'}, - 'some/path/bar.html': {'status': 'M'}, - 'some/path/deleted.html': {'status': 'D'}, - } - }), - 'https://codereview.chromium.org/api/11113333': 'my non-JSON contents', - }) - - def test_latest_try_jobs(self): - rietveld = Rietveld(self.mock_web()) - self.assertEqual( - rietveld.latest_try_jobs(11112222, ('bar-builder', 'other-builder')), - [Build('bar-builder', 60)]) - - def test_latest_try_jobs_http_error(self): - def raise_error(_): - raise urllib2.URLError('Some request error message') - web = self.mock_web() - web.get_binary = raise_error - rietveld = Rietveld(web) - self.assertEqual(rietveld.latest_try_jobs(11112222, ('bar-builder',)), []) - self.assertLog(['ERROR: Request failed to URL: https://codereview.chromium.org/api/11112222\n']) - - def test_latest_try_jobs_non_json_response(self): - rietveld = Rietveld(self.mock_web()) - self.assertEqual(rietveld.latest_try_jobs(11113333, ('bar-builder',)), []) - self.assertLog(['ERROR: Invalid JSON: my non-JSON contents\n']) - - def test_latest_try_jobs_with_patchset(self): - rietveld = Rietveld(self.mock_web()) - self.assertEqual( - rietveld.latest_try_jobs(11112222, ('bar-builder', 'other-builder'), patchset_number=2), - [Build('bar-builder', 50)]) - - def test_latest_try_jobs_no_relevant_builders(self): - rietveld = Rietveld(self.mock_web()) - self.assertEqual(rietveld.latest_try_jobs(11112222, ('foo', 'bar')), []) - - def test_changed_files(self): - rietveld = Rietveld(self.mock_web()) - self.assertEqual( - rietveld.changed_files(11112222), - ['some/path/bar.html', 'some/path/foo.cc']) - - def test_changed_files_no_results(self): - rietveld = Rietveld(self.mock_web()) - self.assertIsNone(rietveld.changed_files(11113333))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py index d7d88950..436aa2d6 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py
@@ -55,7 +55,7 @@ if not self.checkout_is_okay(options.allow_local_commits): return 1 - self.git_cl = GitCL(self.host, auth_refresh_token_json=options.auth_refresh_token_json) + self.git_cl = GitCL(self.host) _log.debug('Noting the current Chromium commit.') _, show_ref_output = self.run(['git', 'show-ref', 'HEAD']) @@ -124,7 +124,7 @@ parser.add_argument('--auto-update', action='store_true', help='uploads CL and initiates commit queue.') parser.add_argument('--auth-refresh-token-json', - help='Rietveld auth refresh JSON token.') + help='Auth refresh JSON token (ignored, deprecated)') parser.add_argument('--ignore-exportable-commits', action='store_true', help='Continue even if there are exportable commits that may be overwritten.') return parser.parse_args(argv) @@ -344,7 +344,7 @@ self.fetch_new_expectations_and_baselines() # Trigger CQ and wait for CQ try jobs to finish. - self.git_cl.run(['set-commit', '--rietveld']) + self.git_cl.run(['set-commit', '--gerrit']) try_results = self.git_cl.wait_for_try_jobs( poll_delay_seconds=POLL_DELAY_SECONDS, timeout_seconds=TIMEOUT_SECONDS) @@ -371,7 +371,7 @@ self.git_cl.run([ 'upload', '-f', - '--rietveld', + '--gerrit', '-m', description, ] + ['--cc=' + email_address for email_address in directory_owners]) @@ -415,7 +415,7 @@ expectation_updater.run(args=[]) message = 'Update test expectations and baselines.' self.check_run(['git', 'commit', '-a', '-m', message]) - self.git_cl.run(['upload', '-m', message, '--rietveld']) + self.git_cl.run(['upload', '-m', message, '--gerrit']) def update_all_test_expectations_files(self, deleted_tests, renamed_tests): """Updates all test expectations files for tests that have been deleted or renamed."""
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py index c495301..e65d5e6 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py
@@ -15,7 +15,6 @@ from webkitpy.common.memoized import memoized from webkitpy.common.net.git_cl import GitCL -from webkitpy.common.net.rietveld import Rietveld from webkitpy.common.webkit_finder import WebKitFinder from webkitpy.layout_tests.models.test_expectations import TestExpectationLine, TestExpectations from webkitpy.w3c.test_parser import TestParser @@ -45,8 +44,7 @@ _log.error('No issue on current branch.') return 1 - rietveld = Rietveld(self.host.web) - builds = rietveld.latest_try_jobs(issue_number, self._get_try_bots()) + builds = self.get_latest_try_jobs() _log.debug('Latest try jobs: %r', builds) if not builds: _log.error('No try job information was collected.') @@ -72,6 +70,10 @@ """Returns current CL number. Can be replaced in unit tests.""" return GitCL(self.host).get_issue_number() + def get_latest_try_jobs(self): + """Returns the latest finished try jobs as Build objects.""" + return GitCL(self.host).latest_try_jobs(self._get_try_bots()) + def get_failing_results_dict(self, build): """Returns a nested dict of failing test results.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py index 80e882201..b705cde 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py
@@ -2,14 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import json import copy from webkitpy.common.host_mock import MockHost from webkitpy.common.net.buildbot import Build from webkitpy.common.net.buildbot_mock import MockBuildBot from webkitpy.common.net.layout_test_results import LayoutTestResult, LayoutTestResults -from webkitpy.common.net.web_mock import MockWeb from webkitpy.common.system.log_testing import LoggingTestCase from webkitpy.layout_tests.builder_list import BuilderList from webkitpy.w3c.wpt_expectations_updater import WPTExpectationsUpdater, MARKER_COMMENT @@ -420,28 +418,15 @@ self.assertEqual(test_results_dict, test_results_dict_copy) def test_run_no_issue_number(self): + # TODO(qyearsley): For testing: Consider making a MockGitCL class + # and use that class to set fake return values when using git cl. updater = WPTExpectationsUpdater(self.mock_host()) updater.get_issue_number = lambda: 'None' self.assertEqual(1, updater.run(args=[])) self.assertLog(['ERROR: No issue on current branch.\n']) def test_run_no_try_results(self): - host = self.mock_host() - host.web = MockWeb(urls={ - 'https://codereview.chromium.org/api/11112222': json.dumps({ - 'patchsets': [1], - }), - 'https://codereview.chromium.org/api/11112222/1': json.dumps({ - 'try_job_results': [] - }) - }) - updater = WPTExpectationsUpdater(host) - updater.get_issue_number = lambda: '11112222' + updater = WPTExpectationsUpdater(self.mock_host()) + updater.get_latest_try_jobs = lambda: [] self.assertEqual(1, updater.run(args=[])) - self.assertEqual( - host.web.urls_fetched, - [ - 'https://codereview.chromium.org/api/11112222', - 'https://codereview.chromium.org/api/11112222/1' - ]) self.assertLog(['ERROR: No try job information was collected.\n'])
diff --git a/third_party/node/node_modules.tar.gz.sha1 b/third_party/node/node_modules.tar.gz.sha1 index 8ca3525..cfef949 100644 --- a/third_party/node/node_modules.tar.gz.sha1 +++ b/third_party/node/node_modules.tar.gz.sha1
@@ -1 +1 @@ -174a7d3b8aee162a03433abb22d1fb2771eeb00e +72d6150ddcff29c0bc48dfb8b175320cb3830d64
diff --git a/third_party/node/package.json b/third_party/node/package.json index 3558ae7..dbe54d9 100644 --- a/third_party/node/package.json +++ b/third_party/node/package.json
@@ -4,7 +4,7 @@ "author": "dpapad@chromium.org", "dependencies": { "crisper": "2.0.2", - "polymer-css-build": "0.0.7", + "polymer-css-build": "0.0.9", "uglifyjs": "2.4.10", "vulcanize": "1.15.2" }
diff --git a/tools/chrome_proxy/webdriver/common.py b/tools/chrome_proxy/webdriver/common.py index 2572a64..47917bf 100644 --- a/tools/chrome_proxy/webdriver/common.py +++ b/tools/chrome_proxy/webdriver/common.py
@@ -327,9 +327,18 @@ """ return self.ExecuteJavascript("return " + script, timeout) - def GetHistogram(self, histogram): + def GetHistogram(self, histogram, timeout=30): + """Gets a Chrome histogram as a dictionary object. + + Args: + histogram: the name of the histogram to fetch + timeout: timeout for the underlying Javascript query. + + Returns: + A dictionary object containing information about the histogram. + """ js_query = 'statsCollectionController.getBrowserHistogram("%s")' % histogram - string_response = self.ExecuteJavascriptStatement(js_query) + string_response = self.ExecuteJavascriptStatement(js_query, timeout) self._logger.debug('Got %s histogram=%s', histogram, string_response) return json.loads(string_response) @@ -382,6 +391,27 @@ self._has_logs = False return all_messages + def SleepUntilHistogramHasEntry(self, histogram_name, sleep_intervals=10): + """Polls if a histogram exists in 1-6 second intervals for 10 intervals. + Allows script to run with a timeout of 5 seconds, so the default behavior + allows up to 60 seconds until timeout. + + Args: + histogram_name: The name of the histogram to wait for + sleep_intervals: The number of polling intervals, each polling cycle takes + no more than 6 seconds. + Returns: + Whether the histogram exists + """ + histogram = {} + while(not histogram and sleep_intervals > 0): + histogram = self.GetHistogram(histogram_name, 5) + if (not histogram): + time.sleep(1) + sleep_intervals -= 1 + + return bool(histogram) + def GetHTTPResponses(self, include_favicon=False, skip_domainless_pages=True): """Parses the Performance Logs and returns a list of HTTPResponse objects.
diff --git a/tools/chrome_proxy/webdriver/fallback.py b/tools/chrome_proxy/webdriver/fallback.py new file mode 100644 index 0000000..4de3956 --- /dev/null +++ b/tools/chrome_proxy/webdriver/fallback.py
@@ -0,0 +1,40 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import common +from common import TestDriver +from common import IntegrationTest + +class Fallback(IntegrationTest): + + # Ensure that when a carrier blocks using the secure proxy, requests fallback + # to the HTTP proxy server. + def testSecureProxyProbeFallback(self): + with TestDriver() as test_driver: + test_driver.AddChromeArg('--enable-spdy-proxy-auth') + + # Set the secure proxy check URL to the google.com favicon, which will be + # interpreted as a secure proxy check failure since the response body is + # not "OK". The google.com favicon is used because it will load reliably + # fast, and there have been problems with chromeproxy-test.appspot.com + # being slow and causing tests to flake. + test_driver.AddChromeArg( + '--data-reduction-proxy-secure-proxy-check-url=' + 'http://www.google.com/favicon.ico') + + # Start chrome to begin the secure proxy check + test_driver.LoadURL('http://www.google.com/favicon.ico') + + self.assertTrue( + test_driver.SleepUntilHistogramHasEntry("DataReductionProxy.ProbeURL")) + + test_driver.LoadURL('http://check.googlezip.net/test.html') + responses = test_driver.GetHTTPResponses() + self.assertNotEqual(0, len(responses)) + for response in responses: + self.assertHasChromeProxyViaHeader(response) + self.assertEqual(u'http/1.1', response.protocol) + +if __name__ == '__main__': + IntegrationTest.RunAllTests()
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 9a667cb..4d64ec16 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -27,14 +27,14 @@ # Do NOT CHANGE this if you don't know what you're doing -- see # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md # Reverting problematic clang rolls is safe, though. -CLANG_REVISION = '289944' +CLANG_REVISION = '295793' use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ if use_head_revision: CLANG_REVISION = 'HEAD' # This is incremented when pushing a new build of Clang at the same revision. -CLANG_SUB_REVISION=2 +CLANG_SUB_REVISION=1 PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION) @@ -71,7 +71,7 @@ 'Linux_x64', 'Release', 'bin') BFD_PLUGINS_DIR = os.path.join(BINUTILS_DIR, 'Linux_x64', 'Release', 'lib', 'bfd-plugins') -VERSION = '4.0.0' +VERSION = '5.0.0' ANDROID_NDK_DIR = os.path.join( CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk') @@ -867,11 +867,6 @@ print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' return 0 - if use_head_revision: - # TODO(hans): Trunk was updated; remove after the next roll. - global VERSION - VERSION = '5.0.0' - global CLANG_REVISION, PACKAGE_VERSION if args.print_revision: if use_head_revision or args.llvm_force_head_revision:
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 8aef59a..8a7a577 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -97483,6 +97483,7 @@ <int value="-1654344175" label="disable-extension-info-dialog"/> <int value="-1649778035" label="disable-clear-browsing-data-counters"/> <int value="-1648216169" label="NewOmniboxAnswerTypes:disabled"/> + <int value="-1634154256" label="ZeroSuggestRedirectToChrome:enabled"/> <int value="-1631329950" label="ssl-version-max"/> <int value="-1630419335" label="enable-download-notification"/> <int value="-1624854957" label="enable-es3-apis"/> @@ -97586,6 +97587,7 @@ <int value="-1203955801" label="enable-password-change-support:disabled"/> <int value="-1203742042" label="enable-gesture-selection"/> <int value="-1201183153" label="enable-centered-app-list"/> + <int value="-1197035323" label="ZeroSuggestRedirectToChrome:disabled"/> <int value="-1184904651" label="enable-npapi"/> <int value="-1184480269" label="LsdPermissionPrompt:enabled"/> <int value="-1177802205" label="enable-hosted-app-quit-notification"/>
diff --git a/ui/events/gesture_detection/gesture_event_data_packet.cc b/ui/events/gesture_detection/gesture_event_data_packet.cc index 9b3af05..fd63932d 100644 --- a/ui/events/gesture_detection/gesture_event_data_packet.cc +++ b/ui/events/gesture_detection/gesture_event_data_packet.cc
@@ -68,9 +68,8 @@ touch_location_(other.touch_location_), raw_touch_location_(other.raw_touch_location_), gesture_source_(other.gesture_source_), - ack_state_(AckState::PENDING), - unique_touch_event_id_(other.unique_touch_event_id_) { -} + ack_state_(other.ack_state_), + unique_touch_event_id_(other.unique_touch_event_id_) {} GestureEventDataPacket::~GestureEventDataPacket() { }
diff --git a/ui/gfx/vector_icons/BUILD.gn b/ui/gfx/vector_icons/BUILD.gn index 7dad812..342682b 100644 --- a/ui/gfx/vector_icons/BUILD.gn +++ b/ui/gfx/vector_icons/BUILD.gn
@@ -67,6 +67,10 @@ "${branding_path_component}/product.icon", ] + if (is_mac) { + icons += [ "google_search_mac_touchbar.icon" ] + } + output_cc = "$target_gen_dir/vector_icons.cc" output_h = "$target_gen_dir/vector_icons.h"
diff --git a/ui/gfx/vector_icons/google_search_mac_touchbar.icon b/ui/gfx/vector_icons/google_search_mac_touchbar.icon new file mode 100644 index 0000000..d8ee51b --- /dev/null +++ b/ui/gfx/vector_icons/google_search_mac_touchbar.icon
@@ -0,0 +1,49 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +CANVAS_DIMENSIONS, 32, +PATH_COLOR_ARGB, 0xFF, 0x42, 0x85, 0xF4, +MOVE_TO, 31.9f, 16.36f, +R_CUBIC_TO, 0, -1.13f, -0.1f, -2.22f, -0.3f, -3.27f, +H_LINE_TO, 16.27f, +R_V_LINE_TO, 6.15f, +R_H_LINE_TO, 8.76f, +R_CUBIC_TO, -0.38f, 2, -1.53f, 3.7f, -3.25f, 4.83f, +R_V_LINE_TO, 4, +R_H_LINE_TO, 5.26f, +R_CUBIC_TO, 3.08f, -2.77f, 4.85f, -6.87f, 4.85f, -11.75f, +CLOSE, +NEW_PATH, +PATH_COLOR_ARGB, 0xFF, 0x34, 0xA8, 0x53, +MOVE_TO, 16.27f, 32, +R_CUBIC_TO, 4.4f, 0, 8.08f, -1.43f, 10.77f, -3.88f, +R_LINE_TO, -5.26f, -4, +R_CUBIC_TO, -1.46f, 0.95f, -3.32f, 1.52f, -5.5f, 1.52f, +R_CUBIC_TO, -4.25f, 0, -7.83f, -2.82f, -9.1f, -6.6f, +H_LINE_TO, 1.72f, +R_V_LINE_TO, 4.15f, +CUBIC_TO, 4.4f, 28.4f, 9.9f, 32, 16.27f, 32, +CLOSE, +NEW_PATH, +PATH_COLOR_ARGB, 0xFF, 0xFB, 0xBC, 0x05, +MOVE_TO, 7.17f, 19.04f, +R_CUBIC_TO, -0.33f, -0.96f, -0.5f, -2, -0.5f, -3.04f, +R_CUBIC_TO, 0, -1.05f, 0.17f, -2.08f, 0.5f, -3.04f, +V_LINE_TO, 8.8f, +H_LINE_TO, 1.73f, +CUBIC_TO, 0.63f, 10.98f, 0, 13.43f, 0, 16, +R_CUBIC_TO, 0, 2.57f, 0.63f, 5.03f, 1.73f, 7.2f, +R_LINE_TO, 5.44f, -4.16f, +CLOSE, +NEW_PATH, +PATH_COLOR_ARGB, 0xFF, 0xEA, 0x43, 0x35, +MOVE_TO, 16.27f, 6.36f, +R_CUBIC_TO, 2.4f, 0, 4.53f, 0.8f, 6.22f, 2.4f, +R_LINE_TO, 4.63f, -4.6f, +CUBIC_TO, 24.33f, 1.6f, 20.63f, 0, 16.23f, 0, +CUBIC_TO, 9.96f, 0, 4.46f, 3.6f, 1.78f, 8.8f, +R_LINE_TO, 5.43f, 4.16f, +R_CUBIC_TO, 1.27f, -3.78f, 4.85f, -6.6f, 9.1f, -6.6f, +CLOSE, +END
diff --git a/ui/views/controls/button/md_text_button.cc b/ui/views/controls/button/md_text_button.cc index 19eeac35..b5e6c1b 100644 --- a/ui/views/controls/button/md_text_button.cc +++ b/ui/views/controls/button/md_text_button.cc
@@ -194,7 +194,7 @@ SetHorizontalAlignment(gfx::ALIGN_CENTER); SetFocusForPlatform(); const int minimum_width = - ViewsDelegate::GetInstance()->GetDialogButtonMinimumWidth(); + ViewsDelegate::GetInstance()->GetButtonMinimumWidth(); SetMinSize(gfx::Size(minimum_width, 0)); SetFocusPainter(nullptr); label()->SetAutoColorReadabilityEnabled(false);
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc index f457cb7c..74cefcc 100644 --- a/ui/views/controls/scroll_view.cc +++ b/ui/views/controls/scroll_view.cc
@@ -7,6 +7,7 @@ #include "base/feature_list.h" #include "base/logging.h" #include "base/macros.h" +#include "ui/base/material_design/material_design_controller.h" #include "ui/events/event.h" #include "ui/gfx/canvas.h" #include "ui/native_theme/native_theme.h" @@ -31,23 +32,7 @@ #endif }; -// Subclass of ScrollView that resets the border when the theme changes. -class ScrollViewWithBorder : public views::ScrollView { - public: - ScrollViewWithBorder() {} - - // View overrides; - void OnNativeThemeChanged(const ui::NativeTheme* theme) override { - SetBorder(CreateSolidBorder( - 1, - theme->GetSystemColor(ui::NativeTheme::kColorId_UnfocusedBorderColor))); - } - - private: - DISALLOW_COPY_AND_ASSIGN(ScrollViewWithBorder); -}; - -class ScrollCornerView : public views::View { +class ScrollCornerView : public View { public: ScrollCornerView() {} @@ -196,7 +181,21 @@ // static ScrollView* ScrollView::CreateScrollViewWithBorder() { - return new ScrollViewWithBorder(); + auto* scroll_view = new ScrollView(); + scroll_view->AddBorder(); + return scroll_view; +} + +// static +ScrollView* ScrollView::GetScrollViewForContents(View* contents) { + View* grandparent = + contents->parent() ? contents->parent()->parent() : nullptr; + if (!grandparent || grandparent->GetClassName() != ScrollView::kViewClassName) + return nullptr; + + auto* scroll_view = static_cast<ScrollView*>(grandparent); + DCHECK_EQ(contents, scroll_view->contents()); + return scroll_view; } void ScrollView::SetContents(View* a_view) { @@ -269,14 +268,21 @@ vert_sb_ = vert_sb; } -void ScrollView::SetHasFocusRing(bool has_focus_ring) { - if (has_focus_ring == (focus_ring_ != nullptr)) +void ScrollView::SetHasFocusIndicator(bool has_focus_indicator) { + if (has_focus_indicator == draw_focus_indicator_) return; - if (has_focus_ring) { - focus_ring_ = FocusRing::Install(this); + draw_focus_indicator_ = has_focus_indicator; + + if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { + DCHECK_EQ(draw_focus_indicator_, !focus_ring_); + if (has_focus_indicator) { + focus_ring_ = FocusRing::Install(this); + } else { + FocusRing::Uninstall(this); + focus_ring_ = nullptr; + } } else { - FocusRing::Uninstall(this); - focus_ring_ = nullptr; + UpdateBorder(); } SchedulePaint(); } @@ -517,6 +523,10 @@ return kViewClassName; } +void ScrollView::OnNativeThemeChanged(const ui::NativeTheme* theme) { + UpdateBorder(); +} + void ScrollView::ScrollToPosition(ScrollBar* source, int position) { if (!contents_) return; @@ -736,6 +746,23 @@ } } +void ScrollView::AddBorder() { + draw_border_ = true; + UpdateBorder(); +} + +void ScrollView::UpdateBorder() { + if (!draw_border_ || !GetWidget()) + return; + + SetBorder(CreateSolidBorder( + 1, + GetNativeTheme()->GetSystemColor( + draw_focus_indicator_ + ? ui::NativeTheme::kColorId_FocusedBorderColor + : ui::NativeTheme::kColorId_UnfocusedBorderColor))); +} + // VariableRowHeightScrollHelper ---------------------------------------------- VariableRowHeightScrollHelper::VariableRowHeightScrollHelper(
diff --git a/ui/views/controls/scroll_view.h b/ui/views/controls/scroll_view.h index db38b2c8..af9111a 100644 --- a/ui/views/controls/scroll_view.h +++ b/ui/views/controls/scroll_view.h
@@ -46,6 +46,10 @@ // Creates a ScrollView with a theme specific border. static ScrollView* CreateScrollViewWithBorder(); + // Returns the ScrollView for which |contents| is its contents, or null if + // |contents| is not in a ScrollView. + static ScrollView* GetScrollViewForContents(View* contents); + // Set the contents. Any previous contents will be deleted. The contents // is the view that needs to scroll. void SetContents(View* a_view); @@ -88,8 +92,8 @@ void SetHorizontalScrollBar(ScrollBar* horiz_sb); void SetVerticalScrollBar(ScrollBar* vert_sb); - // Sets whether this ScrollView has a focus ring or not. - void SetHasFocusRing(bool has_focus_ring); + // Sets whether this ScrollView has a focus indicator or not. + void SetHasFocusIndicator(bool has_focus_indicator); // View overrides: gfx::Size GetPreferredSize() const override; @@ -100,6 +104,7 @@ void OnScrollEvent(ui::ScrollEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override; const char* GetClassName() const override; + void OnNativeThemeChanged(const ui::NativeTheme* theme) override; // ScrollBarController overrides: void ScrollToPosition(ScrollBar* source, int position) override; @@ -154,6 +159,9 @@ // Horizontally scrolls the header (if any) to match the contents. void ScrollHeader(); + void AddBorder(); + void UpdateBorder(); + // The current contents and its viewport. |contents_| is contained in // |contents_viewport_|. View* contents_; @@ -186,6 +194,13 @@ // than the viewport). bool hide_horizontal_scrollbar_; + // In Harmony, the indicator is a focus ring. Pre-Harmony, the indicator is a + // different border painter. + bool draw_focus_indicator_ = false; + + // Only needed for pre-Harmony. Remove when Harmony is default. + bool draw_border_ = false; + // Focus ring, if one is installed. View* focus_ring_ = nullptr;
diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc index 94fe60c..ab17e37 100644 --- a/ui/views/controls/table/table_view.cc +++ b/ui/views/controls/table/table_view.cc
@@ -546,8 +546,6 @@ const bool is_selected = selection_model_.IsSelected(model_index); if (is_selected) canvas->FillRect(GetRowBounds(i), selected_bg_color); - if (selection_model_.active() == model_index && HasFocus()) - canvas->DrawFocusRect(GetRowBounds(i)); for (int j = region.min_column; j < region.max_column; ++j) { const gfx::Rect cell_bounds(GetCellBounds(i, j)); int text_x = kTextHorizontalPadding + cell_bounds.x(); @@ -625,11 +623,18 @@ } void TableView::OnFocus() { + ScrollView* scroll_view = ScrollView::GetScrollViewForContents(this); + if (scroll_view) + scroll_view->SetHasFocusIndicator(true); SchedulePaintForSelection(); + NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true); } void TableView::OnBlur() { + ScrollView* scroll_view = ScrollView::GetScrollViewForContents(this); + if (scroll_view) + scroll_view->SetHasFocusIndicator(false); SchedulePaintForSelection(); }
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc index 7e964f9..fc75419 100644 --- a/ui/views/controls/tree/tree_view.cc +++ b/ui/views/controls/tree/tree_view.cc
@@ -638,7 +638,7 @@ if (GetInputMethod()) GetInputMethod()->OnCaretBoundsChanged(GetPrefixSelector()); - SetHasFocusRing(true); + SetHasFocusIndicator(true); } void TreeView::OnBlur() { @@ -647,7 +647,7 @@ SchedulePaintForNode(selected_node_); if (selector_) selector_->OnViewBlur(); - SetHasFocusRing(false); + SetHasFocusIndicator(false); } bool TreeView::OnClickOrTap(const ui::LocatedEvent& event) { @@ -807,8 +807,6 @@ if (!PlatformStyle::kTreeViewSelectionPaintsEntireRow && node == selected_node_) { canvas->FillRect(text_bounds, selected_row_bg_color); - if (HasFocus()) - canvas->DrawFocusRect(text_bounds); } // Paint the text. @@ -1057,20 +1055,13 @@ return arrow_bounds.Contains(point); } -void TreeView::SetHasFocusRing(bool shows) { - if (!ui::MaterialDesignController::IsSecondaryUiMaterial() || - !PlatformStyle::kTreeViewHasFocusRing) { - return; - } +void TreeView::SetHasFocusIndicator(bool shows) { // If this View is the grandchild of a ScrollView, use the grandparent // ScrollView for the focus ring instead of this View so that the focus ring - // won't be scrolled. Since ScrollViews have a single content view, which they - // wrap in a ScrollView::Viewport, being the grandchild of a ScrollView - // implies being the sole grandchild, which means it's fine to wrap the focus - // ring around the grandparent here. - View* grandparent = parent() ? parent()->parent() : nullptr; - if (grandparent && grandparent->GetClassName() == ScrollView::kViewClassName) - static_cast<ScrollView*>(grandparent)->SetHasFocusRing(shows); + // won't be scrolled. + ScrollView* scroll_view = ScrollView::GetScrollViewForContents(this); + if (scroll_view) + scroll_view->SetHasFocusIndicator(shows); } // InternalNode ----------------------------------------------------------------
diff --git a/ui/views/controls/tree/tree_view.h b/ui/views/controls/tree/tree_view.h index 63ea2ed..5de65d3 100644 --- a/ui/views/controls/tree/tree_view.h +++ b/ui/views/controls/tree/tree_view.h
@@ -349,10 +349,8 @@ // control. bool IsPointInExpandControl(InternalNode* node, const gfx::Point& point); - // Sets whether a focus ring is visible on this control or not. This function - // does nothing if focus rings aren't enabled in general or if the platform's - // style does not use focus rings on TreeViews. - void SetHasFocusRing(bool); + // Sets whether a focus indicator is visible on this control or not. + void SetHasFocusIndicator(bool); // The model, may be null. ui::TreeModel* model_;
diff --git a/ui/views/layout/layout_constants.h b/ui/views/layout/layout_constants.h index e375ad7..620a28d 100644 --- a/ui/views/layout/layout_constants.h +++ b/ui/views/layout/layout_constants.h
@@ -83,6 +83,12 @@ // and the start of its corresponding text. constexpr int kItemLabelSpacing = 10; +// Padding on the left and right of a button's contents. +const int kButtonHorizontalPadding = 16; + +// Default minimum width of buttons. +const int kMinimumButtonWidth = 48; + // Minimum width of dialog buttons. const int kDialogMinimumButtonWidth = 75;
diff --git a/ui/views/style/platform_style.cc b/ui/views/style/platform_style.cc index b744302..0dff5cb 100644 --- a/ui/views/style/platform_style.cc +++ b/ui/views/style/platform_style.cc
@@ -48,7 +48,6 @@ const CustomButton::KeyClickAction PlatformStyle::kKeyClickActionOnSpace = CustomButton::CLICK_ON_KEY_RELEASE; const bool PlatformStyle::kReturnClicksFocusedControl = true; -const bool PlatformStyle::kTreeViewHasFocusRing = false; const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = false; const bool PlatformStyle::kUseRipples = true; const bool PlatformStyle::kMirrorBubbleArrowInRTLByDefault = true;
diff --git a/ui/views/style/platform_style.h b/ui/views/style/platform_style.h index 93b8c84..5e31fa2 100644 --- a/ui/views/style/platform_style.h +++ b/ui/views/style/platform_style.h
@@ -56,9 +56,6 @@ // Otherwise, Return does nothing unless it is handled by an accelerator. static const bool kReturnClicksFocusedControl; - // Whether TreeViews get a focus ring on the entire TreeView when focused. - static const bool kTreeViewHasFocusRing; - // Whether selecting a row in a TreeView selects the entire row or only the // label for that row. static const bool kTreeViewSelectionPaintsEntireRow;
diff --git a/ui/views/style/platform_style_mac.mm b/ui/views/style/platform_style_mac.mm index a335d99..e1d396e 100644 --- a/ui/views/style/platform_style_mac.mm +++ b/ui/views/style/platform_style_mac.mm
@@ -25,7 +25,6 @@ const bool PlatformStyle::kDialogDefaultButtonCanBeCancel = false; const bool PlatformStyle::kSelectWordOnRightClick = true; const bool PlatformStyle::kSelectAllOnRightClickWhenUnfocused = true; -const bool PlatformStyle::kTreeViewHasFocusRing = true; const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = true; const bool PlatformStyle::kUseRipples = false;
diff --git a/ui/views/views_delegate.cc b/ui/views/views_delegate.cc index 8856e7e..8a78a96 100644 --- a/ui/views/views_delegate.cc +++ b/ui/views/views_delegate.cc
@@ -152,12 +152,16 @@ return gfx::Insets(kPanelVertMargin, kPanelHorizMargin); } +int ViewsDelegate::GetButtonMinimumWidth() const { + return kMinimumButtonWidth; +} + int ViewsDelegate::GetDialogButtonMinimumWidth() const { return kDialogMinimumButtonWidth; } int ViewsDelegate::GetButtonHorizontalPadding() const { - return 0; + return kButtonHorizontalPadding; } ViewsDelegate::ViewsDelegate()
diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h index b354330..7b3960f 100644 --- a/ui/views/views_delegate.h +++ b/ui/views/views_delegate.h
@@ -219,7 +219,10 @@ // Returns the margins that should be applied around a bubble dialog. virtual gfx::Insets GetBubbleDialogMargins() const; - // Returns the default minimum width of a dialog button. + // Returns the default minimum width of a button. + virtual int GetButtonMinimumWidth() const; + + // Returns the minimum width of a dialog button. virtual int GetDialogButtonMinimumWidth() const; // Returns the default padding to add on each side of a button's label.
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc index deff7dc..f646639 100644 --- a/ui/views/window/dialog_client_view.cc +++ b/ui/views/window/dialog_client_view.cc
@@ -296,8 +296,6 @@ button = MdTextButton::CreateSecondaryUiButton(this, title); } - // TODO(bsep): Setting the minimum size is redundant with MdTextButton, so - // this can be deleted when harmony is always on. const int minimum_width = ViewsDelegate::GetInstance()->GetDialogButtonMinimumWidth(); button->SetMinSize(gfx::Size(minimum_width, 0));