Avoid losing focus on the search box in Settings.

Before, after clearing the search box, focus got moved to the first focusable element on the option page. Since the search box is outside of option pages, it caused releasing the focus, which is not the intended behaviour. This patch keeps the focus on the search box after clearing it.

To do so, focus is restored only, when previously another control was focused, but within the previous option page. Therefore, if there is another control focused, such as the search box or any other control outside of the option page, then it will not be released, which seem to be the intended behaviour.

TEST=Follow the bug's repro steps.
BUG=257326
R=dbeam@chromium.org, tkent@chromium.org

Review URL: https://codereview.chromium.org/19623004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214524 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 214524
Fix processing pending tasks in the image loader.

Before, the current request was incorrectly passed to the callback. As a result, callbacks had the last item in the collection instead of the current one. This patch resolves this issue by passing the current item via bind().

TEST=Gallery in Files.app should work fine.
BUG=265801
R=hidehiko@chromium.org

Review URL: https://codereview.chromium.org/21145008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214525 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 214525
Add a share button to Files.app.

This patch adds the share button to the Files.app's footer.

TEST=In Files.app, got o Drive, verify that there is a share button and it is clickable.
BUG=265559
R=yoshiki@chromium.org

Review URL: https://codereview.chromium.org/21087009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214526 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 214526
Remove flags for the sharing dialog.

Since the sharing dialog is now enabled by default, we can safely remove the flags.

TEST=Tested manually. Sharing item should appear in the context menu on Drive in Files.app.
BUG=141396
R=yoshiki@chromium.org

Review URL: https://codereview.chromium.org/21206002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214527 0039d316-1c4b-4281-b951-d872f2087c98
Add unit tests for cache-control: no-cache header.

This patch adds two simple unit-tests that verify that
no-cache resources are indeed placed in cache, but retrieved
only with LOAD_PREFERRING_CACHE.

Review URL: https://chromiumcodereview.appspot.com/12319153

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214528 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 214527
Fix flickering when transitioning from composited to non-composited.

Consider a RenderWidgetHostViewMac which is in compositing mode and has
AllowOverlappingViews set. This is effected by
making the NSOpenGLContext context be below the window (by setting
NSOpenGLCPSurfaceOrder to -1) and making the window transparent
(fillRecting it to clearColor).

When transition from compositing mode to software mode, the OpenGL
context is unbound from the view, and then the window is painted with
the rendered contents.

What was going wrong in this bug is that the window is being repainted
from clearColor to the new contents after the OpenGL context which was
underneath it is removed. The effect is that for a few frames, only the
transparent window was there.

Prevent this flicker by leaving the GL context bound to the view, even
after switching back to software mode. This is not a substantial change
to the previous behavior. In both cases the IOSurface and its texture
are freed. In both cases the NSOpenGLContext is not destroyed. In both
cases there are code paths that leaves the NSOpenGLContext current to
the view through destruction.

Note that this fixes this one instance of flickering. There may be
others, but they are much less visible than this.

BUG=154531
TBR=thakis@chromium.org,kbr@chromium.org

TEST=Note that these are different instructions than in M28!!

TEST=Run Chrome with --disable-force-compositing-mode and
--show-composited-layer-borders. Go to
https://www.khronos.org/registry/webgl/conformance-suites/1.0.1/webgl-conformance-tests.html
Open the find bar by pressing command-f, and leave it open through
the rest of the test. Now click the "run" button next to attribs. You
should see the blue compositing grid clicker on the page as the results
come in, but there should be no transparent flickering. This is intermittent,
so press the run button a few times.

TEST=With the same browser set-up, go to gmail and open an email
thread. Now open the find bar by pressing command-f. There should be
no blue compositor grid visible. Now, click Reply on an email. There should
now be a blue compositor grid (and you should see gold boxes around the
various UI elements). Click on Discard. The grid should go away, but there
should be no transparent flickering.

NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/19695016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214529 0039d316-1c4b-4281-b951-d872f2087c98
Add a presubmit check for tabs in grd files.

Review URL: https://chromiumcodereview.appspot.com/19741006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214530 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 214529
Track unread streams in SimpleCache.CheckCRCResult

We're seeing very high rates of reporting (~37%) of "Was never read to
end" from SimpleCache.CheckCRCResult. This is almost certainly from
unread metadata streams (~33% of streams) and HTTP payloads being
unread because the headers force an update (CantConditionalize = 4% of
requests, and Updated = 1% of requests).

By distinguishing never read streams from partially read streams, we
can be more sure about how often we risk providing bad data to
clients.

R=clamy,pasko
BUG=None

Review URL: https://chromiumcodereview.appspot.com/19749010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214531 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 214531
Fix updating commands when drive state changes.

Before, commands were updates only when focus changes. As a result, when Chrome OS went offline, delete button and the share button were not being disabled. This patch resolves this issue by updating every command, when drive status changes (online, offline).

TEST=Go to Drive, disable wifi, delete button should disappear and the share button should get grayed out.
BUG=265565
R=yoshiki@chromium.org

Review URL: https://codereview.chromium.org/21186004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214532 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 214532
cc: Don't require push properties for picture layers

PictureLayer now only needs push properties if its pile has changed.  In
order to make this possible, some of the non-pushing post-commit work
had to be deferred so that every layer that got committed (even if it
didn't get pushed) would go through it.  This is lazily done with a
boolean flag in PictureLayerImpl, with some DCHECKs for sanity about its
state.

As every layer on the pending tree that will get drawn will be
CalcDrawEtc'd and get UpdateTilePriorities first, this seems a safe
place to put this lazy check.

R=danakj@chromium.org
BUG=259402

Review URL: https://chromiumcodereview.appspot.com/19540014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214533 0039d316-1c4b-4281-b951-d872f2087c98
No bookmark sync promo if sync is disabled by policy. 

Prevents the bookmark sync promo to be displayed when sync is disabled by policy. 

It's possible to sign in to Chrome without enabling sync. For that reason, some sync promos have become sign in promos lately. In this CL, most functions from sync_promo_ui.h have been moved to a new chrome/browser/signin/signin_promo.h file to be consistent with that change.

TEST= 
1. Start Chrome with command line flags --disable-sync and --enable-bookmark-sync-promo. 
2. If necessary, sign out of Chrome (hot-dog menu > Settings > Disconnect you Google Account...). 
2. Observe that no sync promo is displayed in the bookmark bubble. 
BUG=262950

Review URL: https://chromiumcodereview.appspot.com/19804009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214534 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 214533
Refactored touch-events flag test, correcting "enabled" logic.

We previously ignored the "enabled" flag if there was no touch device detected. We also ignored "disabled" in many places, so that we always ended up with touch if there was a touch device.

Also, remove reference to gestures - no longer reachable.

BUG=176058

Review URL: https://chromiumcodereview.appspot.com/19805005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214535 0039d316-1c4b-4281-b951-d872f2087c98