text:
<link rel="stylesheet" type="text/css" media="screen" href="http://a123.g.akamai.net/f/123/12465/1d/www.canada.com/css/newspaper/victoriatimescolonist/global.css">

<link rel="stylesheet" type="text/css" media="screen" href="http://a123.g.akamai.net/f/123/12465/1d/www.canada.com/css/newspaper/victoriatimescolonist/widgets.css">

<link rel="stylesheet" type="text/css" media="screen" href="http://a123.g.akamai.net/f/123/12465/1d/www.canada.com/css/newspaper/nationalpost_home.css">

<title>
Internet to get 10 times faster
</title>
<link rel="stylesheet" type="text/css" media="screen" href="http://a123.g.akamai.net/f/123/12465/1d/www.canada.com/css/newspaper/newspapers_story_template_v3.css">

<link rel="stylesheet" type="text/css" media="screen" href="http://a123.g.akamai.net/f/123/12465/1d/www.canada.com/newspaperheader/victoriatimescolonist/header_v2/css/header_v2.css">

<link rel="stylesheet" type="text/css" media="print" href="http://a123.g.akamai.net/f/123/12465/1d/www.canada.com/newspaperheader/victoriatimescolonist/header_v2/css/header_v2_print.css">

<select name="Newspapers, TV, Radio" style="font-size: 10px; font-family: Arial; width: 200px;">
<option value="http://www.canada.com/" class="nolink">
canada.com, Newspapers, TV, Radio
</option>
<optgroup label="canada.com">
<option value="http://www.canada.com/">
Home
</option>
<option value="http://www.canada.com/topics/news/index.html">
News
</option>
<option value="http://www.canada.com/topics/sports/index.html">
Sports
</option>
<option value="http://www.canada.com/topics/entertainment/index.html">
Entertainment
</option>
<option value="http://www.canada.com/topics/bodyandhealth/index.html">
Health
</option>
<option value="http://www.canada.com/topics/travel/index.html">
Travel
</option>
</optgroup>
<optgroup label="NEWSPAPERS">
<option value="http://www.nationalpost.com/">
National Post
</option>
<option value="http://www.canada.com/victoriatimescolonist/">
Victoria Times Colonist
</option>
<option value="http://www.canada.com/theprovince/">
The Province (Vancouver)
</option>
<option value="http://www.canada.com/vancouversun/">
Vancouver Sun
</option>
<option value="http://www.canada.com/edmontonjournal/">
Edmonton Journal
</option>
<option value="http://www.canada.com/calgaryherald/">
Calgary Herald
</option>
<option value="http://www.canada.com/reginaleaderpost/">
Regina Leader-Post
</option>
<option value="http://www.canada.com/saskatoonstarphoenix/">
Saskatoon StarPhoenix
</option>
<option value="http://www.canada.com/windsorstar/">
Windsor Star
</option>
<option value="http://www.canada.com/ottawacitizen/">
Ottawa Citizen
</option>
<option value="http://www.canada.com/montrealgazette/">
The Gazette (Montreal)
</option>
<option value="http://www.dose.ca/">
DOSE
</option>
<option value="http://www.canada.com/vancouverisland/">
Vancouver Island Newspapers
</option>
<option value="http://www.van.net/">
VANNET Newspapers
</option>
</optgroup>
<optgroup label="TELEVISION">
<option value="http://www.globaltv.com/">
Global TV
</option>
<option value="http://www.canada.com/globaltv/national/index.html">
Global National
</option>
<option value="http://www.canada.com/globaltv/bc/index.html">
Global BC
</option>
<option value="http://www.canada.com/globaltv/calgary/index.html">
Global Calgary
</option>
<option value="http://www.canada.com/globaltv/edmonton/index.html">
Global Edmonton
</option>
<option value="http://www.canada.com/globaltv/lethbridge/index.html">
Global Lethbridge
</option>
<option value="http://www.canada.com/globaltv/saskatoon/index.html">
Global Saskatoon
</option>
<option value="http://www.canada.com/globaltv/regina/index.html">
Global Regina
</option>
<option value="http://www.canada.com/globaltv/winnipeg/index.html">
Global Winnipeg
</option>
<option value="http://www.canada.com/globaltv/ontario/index.html">
Global Ontario
</option>
<option value="http://www.canada.com/globaltv/quebec/index.html">
Global Quebec
</option>
<option value="http://www.canada.com/globaltv/maritimes/index.html">
Global Maritimes
</option>
<option value="http://www.eonline.com/index.jsp">
E!
</option>
<option value="http://www.canada.com/ch/cheknews/index.html">
CHEK NEWS
</option>
<option value="http://www.canada.com/ch/chcanews/index.html">
CHCA NEWS
</option>
<option value="http://www.canada.com/ch/chchnews/index.html">
CHCH NEWS
</option>
<option value="http://www.canada.com/ch/cjntmontreal/index.html">
CJNT Montreal
</option>
<option value="http://www.canada.com/tvtropolis/index.html">
TVTropolis
</option>
<option value="http://www.dose.ca/xtreme/index.html">
X-treme Sports
</option>
<option value="http://www.canada.com/specialtytv/">
Specialty Channels
</option>
</optgroup>
</select>

local classifieds

jobs

cars

obituaries

celebrating

shopping

homes

dating

See today's Digital Edition

Subscribe to email newsletter

Subscriber Services

Â

5°C

Â

Partly cloudy

Detailed Forecast

Â

Times Colonist Home

Search for

<form name="searchform">

<input id="q" name="q" value="" type="text">

<select id="searchtype">
<option value="newspaper">
in the Times Colonist
</option>
<option value="workingjob">
Jobs in Victoria working.com
</option>
<option value="marketplace">
in Newspaper ads
</option>
<option value="fp">
10 year archive in FPinfomart
</option>
<option value="canada">
in canada.com
</option>
</select>

<input class="x-nc-invisible">

<input class="x-nc-invisible">

<input class="x-nc-invisible">

</form>

Digital Products

See today's Digital Edition

Subscribe to email newsletter

Inside Times Colonist

News

Capital & Van. Isl.

Comment

Letters

Business

Sports

Life

Arts

Columnists

30 day Archive

Headline             Scan

The Stocks Page

Newspaper Ads

Special Sections

Weekly Sections

Books and Ideas

Travel

Automotive

Go!

Homes

Features

Victoria's Sewage

New Homes Special

Classifieds

Marketplace

Find a job at working.com

Find a car

Find an apartment at househunting.ca

Find real estate at Homes

Find great stuff at shopping

Announcements

Announcements at Celebrating.com

Obituaries at Remembering

General Classifieds

Local classifieds

Selling?           Place an ad

Meet a match           at Connecting

Enter our contests

Local Contests

National Contests

Your Times Colonist

Subscriber           Services

Subscribe

Renew           subscription

Update           credit card information

Send us a news tip

Advertising

About Us

Contact us

Privacy Statement

Letters

To the editor

About your event

Site           feedback

Login Issues

Â

Today's Colonist

Coming soon: Special bus lanes

Greater Victoria will be one of three urban areas to feature RapidBus service as...

[ more ]

Â

Esquimalt man arrested in porn investigation

Wait times costing Canada billions, says CMA

One Canadian soldier dead, one injured in Afghan IED blast

Â

More News Stories

News on canada.com

Canadian soldier killed in Afghanistan

One Canadian soldier was killed and a second was injured when their armoured vehicle...

[ more ]

Â

Bank mergers 'not a priority' for Flaherty

Mourners fill Bathurst arena for wake of basketball players

Â

More on canada.com

Internet to get 10 times faster

Four-minute movie downloads will be possible

CanWest News Service

Published:Â Wednesday, January 09, 2008

LAS VEGAS -- Imagine being able to download a movie in four minutes. That's what's possible with new technology unveiled at the Consumer Electronics Show in Las Vegas yesterday -- technology that makes so-called high-speed Internet 10 times faster than today.

Comcast Corp., the largest U.S. cable company, plans to roll out the new service to Americans this year that will hit top speeds of 160 megabits per second.

Recent upgrades to Comcast's high-speed Internet network use a technology called DOCsis 3.0. Today's high-speed connections are capable of providing connection speeds of around 10 megabits per second. With the improvements, Comcast will be providing customers with speeds in excess of 100 megabits per second when the service launches this summer.

Email to a friend

Printer friendly

Font:

Using the service, a high-definition copy of the movie Batman Begins can be downloaded in less than four minutes. To tackle the same feat with a dial-up connection would take more than a week. With today's high-speed Internet networks, it would take about six hours.

Comcast's cable technologies are similar to those used by Rogers Cable in Canada.

© Times Colonist (Victoria) 2008

Ads by Google

<link rel="stylesheet" type="text/css" media="screen" href="http://a123.g.akamai.net/f/123/12465/1d/www.canada.com/css/widget_video.css">

Inside the

canada.com Network

.

'Shipping container' hotel

A new hotel built from shipping...

Â

Golden Globes winners

The Golden Globes ceremony may...

Â

Â

Dead hearts beat again

Researchers say they have coaxed...

Â

Â

Newspapers:

National Post

Victoria Times Colonist

The Province (Vancouver)

Vancouver Sun

Edmonton Journal

Calgary Herald

Regina Leader-Post

Saskatoon StarPhoenix

Windsor Star

Ottawa Citizen

The Gazette (Montreal)

DOSE

Vancouver Island Newspapers

VANNET Newspapers

Television:

Global

E!

TVTropolis

CoolTV

DejaView

Fox Sports World Canada

LONESTAR

Men TV

MysteryTV

X-TREME Sports

Marketplace:

working.com

driving.ca

connecting

celebrating

remembering

househunting

shop

CanWest Countries:

Australia

New Zealand

Ireland

United States, The New Republic

About canada.com

Who We Are

Site Map

FAQs

Privacy

Terms

Contact Us

Copyright & Permission Rules

© 2008 CanWest Interactive, a division of

CanWest MediaWorks Publications Inc.

. All rights reserved. Unauthorized distribution, transmission or republication strictly prohibited.


text:
'''
## License

The MIT License (MIT)

GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.
Copyright (C) 2015  Dexter Industries

Jetduino for the Jetson TK1/TX1: an open source platform for connecting
Grove Sensors to the Jetson embedded supercomputers.
Copyright (C) 2016  NeuroRobotic Technologies

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''

import time
import jetduino
from jetduino_pins import *

# Connect the Grove Sound Sensor to analog port A0
# SIG,NC,VCC,GND
sound_sensor = ARD_A0

# Connect the Grove LED to digital port D5
# SIG,NC,VCC,GND
led = LED_D4

jetduino.pinMode(led, OUTPUT_PIN)

# The threshold to turn the led on 400.00 * 5 / 1024 = 1.95v
threshold_value = 600

while True:
    try:
        # Read the sound level
        sensor_value = jetduino.analogRead(sound_sensor)

        # If loud, illuminate LED, otherwise dim
        if sensor_value > threshold_value:
            jetduino.digitalWrite(led, HIGH)
        else:
            jetduino.digitalWrite(led, LOW)

        print ("sensor_value =", sensor_value)
        time.sleep(.5)

    except IOError:
        print ("Error")

redpajama_set_name: RedPajamaGithub


text:
> 編寫: [spencer198711](https://github.com/spencer198711) - 原文:<http://developer.android.com/training/backward-compatible-ui/older-implementation.html>

這一課討論瞭如何創建一個支持舊的設備並且與新的APIs接口相同的實現。

## 決定一個替代方案

在以向後兼容的方式使用較新的UI功能的時候,最具挑戰的任務是為舊的平臺版本決定一個解決方案。在很多情況下,使用舊的UI框架中的功能是有可能完成這些新的UI組件的。例如:

* Action Bar可以使用水平的包含圖片按鈕的LinearLayout來實現,這個在Activity中的LinearLayout作為自定義標題欄或者僅僅作為視圖。下拉功能行為可以使用設備的菜單按鈕來實現。
* Action Bar的tab頁可以使用包含按鈕的水平的LinearLayout,或者使用[TabWidget](http://developer.android.com/reference/android/widget/TabWidget.html)UI控件來實現。
* [NumberPicker](http://developer.android.com/reference/android/widget/NumberPicker.html)和[Switch](http://developer.android.com/reference/android/widget/Switch.html)控件可以分別通過使用[Spinner](http://developer.android.com/reference/android/widget/Spinner.html)和[ToggleButton](http://developer.android.com/reference/android/widget/ToggleButton.html)控件來實現。
* [ListPopupWindow](http://developer.android.com/reference/android/widget/ListPopupWindow.html)和[PopupMenu](http://developer.android.com/reference/android/widget/PopupMenu.html)控件可以通過使用[PopupWindow](http://developer.android.com/reference/android/widget/PopupWindow.html)來實現。

為了往老的設備上向後移植UI組件,這些一般不是一刀切的解決方案。注意用戶體驗:在老的設備上,用戶可能不熟悉新的界面設計模式和UI組件,思考一下如何使用熟悉的控件去實現相同的功能。在很多種情況下,這些通常不會被注意到,特別是在如果新的UI組件在應用程序的生態系統中是突出的(比如Action Bar),或者交互模型是非常簡單和直觀的(比如使用[ViewPager](http://developer.android.com/reference/android/support/v4/view/ViewPager.html)去滑動界面)。

## 使用舊的APIs實現Tabs

你可以使用[TabWidget](http://developer.android.com/reference/android/widget/TabWidget.html)和[TabHost](http://developer.android.com/reference/android/widget/TabHost.html)(儘管其中一個也可以使用水平方向的Button控件)去創建Action Bar Tabs的老的實現。可以在TabHelperEclair和CompatTabEclair的類中去實現,因為這些實現使用了不遲於Android 2.0(Eclair)的APIs。

![backward-compatible-ui-classes-eclair](backward-compatible-ui-classes-eclair.png)

* 圖1. Eclair版本上實現tabs的類圖

`CompatTabEclair`在實例變量中保存了諸如tab文本和tab圖標等tab屬性,因為在老的版本中沒有[ActionBar.Tab](http://developer.android.com/reference/android/app/ActionBar.Tab.html)對象去處理這些數據存儲。

```java
public class CompatTabEclair extends CompatTab {
    // Store these properties in the instance,
    // as there is no ActionBar.Tab object.
    private CharSequence mText;
    ...

    public CompatTab setText(int resId) {
        // Our older implementation simply stores this
        // information in the object instance.
        mText = mActivity.getResources().getText(resId);
        return this;
    }

    ...
    // Do the same for other properties (icon, callback, etc.)
}
```

`TabHelperEclair`利用了[TabHost](http://developer.android.com/reference/android/widget/TabHost.html)控件的方法去創建[TabHost.TabSpec](http://developer.android.com/reference/android/widget/TabHost.TabSpec.html)對象和tab的頁面指示效果:

```java
public class TabHelperEclair extends TabHelper {
    private TabHost mTabHost;
    ...

    protected void setUp() {
        if (mTabHost == null) {
            // Our activity layout for pre-Honeycomb devices
            // must contain a TabHost.
            mTabHost = (TabHost) mActivity.findViewById(
                    android.R.id.tabhost);
            mTabHost.setup();
        }
    }

    public void addTab(CompatTab tab) {
        ...
        TabSpec spec = mTabHost
                .newTabSpec(tag)
                .setIndicator(tab.getText()); // And optional icon
        ...
        mTabHost.addTab(spec);
    }

    // The other important method, newTab() is part of
    // the base implementation.
}
```

現在你已經有了兩種`CompatTab`和`TabHelper`的實現,一種是使用了新的APIs為了能夠在Android 3.0或其後版本設備上能夠運行,另一種則是使用了舊的APIs為了在Android 2.0或之前的設備上能夠運行。下一課討論在應用中使用這兩種實現。


text:
import { SchemeAuthenticate } from './SchemeAuthenticate';
import { SchemeConfig } from './SchemeConfig';
import { HapiSamlOptions } from './HapiSamlOptions';
import { HapiSaml } from './HapiSaml';

export const SchemeImpl = (
  saml: HapiSaml,
  options: HapiSamlOptions,
  propKey: string,
  cookieName: string
) => (server: any, settings?: SchemeConfig | any) => {
  if (!settings) {
    throw new Error('Missing scheme config');
  }

  const cookieOptions = {
    encoding: 'iron',
    path: '/',
    password: settings.password,
    isSecure: settings.isSecure !== false, // Defaults to true
    isHttpOnly: settings.isHttpOnly !== false, // Defaults to true
    isSameSite: settings.isSameSite || 'Strict',
    ttl: settings.ttl
    //domain: settings.domain,
    //ignoreErrors: true,
    //clearInvalid: true
  };
  settings.cookie = cookieName;

  try {
    server.state(settings.cookie, cookieOptions);
  } catch (e) {
    throw e;
  }

  return {
    authenticate: SchemeAuthenticate(saml, settings, propKey)
  };
};


text:
package io.druid.indexing.kafka;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.Inject;
import com.metamx.http.client.HttpClient;
import io.druid.guice.annotations.EscalatedGlobal;
import io.druid.guice.annotations.Json;
import io.druid.indexing.common.TaskInfoProvider;
import org.joda.time.Duration;

public class KafkaIndexTaskClientFactory
{
  private HttpClient httpClient;
  private ObjectMapper mapper;

  @Inject
  public KafkaIndexTaskClientFactory(
      @EscalatedGlobal HttpClient httpClient,
      @Json ObjectMapper mapper
  )
  {
    this.httpClient = httpClient;
    this.mapper = mapper;
  }

  public KafkaIndexTaskClient build(
      TaskInfoProvider taskInfoProvider,
      String dataSource,
      int numThreads,
      Duration httpTimeout,
      long numRetries
  )
  {
    return new KafkaIndexTaskClient(
        httpClient,
        mapper,
        taskInfoProvider,
        dataSource,
        numThreads,
        httpTimeout,
        numRetries
    );
  }
}


text:
angular.module('app').filter("imageFilter", function() {
  return function(items, from, to) {
    var result = [];
    angular.forEach(items, function(item, from, to){
      var itemDate = new Date(item.created_at);
      if(from < itemDate < to){
        result.push(item)
      }
    })
    return result;
  };
});


text:
using Google.ProtocolBuffers.Descriptors;

namespace Google.ProtocolBuffers.FieldAccess
{
    /// <summary>
    /// Accessor for fields representing a non-repeated enum value.
    /// </summary>
    internal sealed class SingleEnumAccessor<TMessage, TBuilder> : SinglePrimitiveAccessor<TMessage, TBuilder>
        where TMessage : IMessage<TMessage, TBuilder>
        where TBuilder : IBuilder<TMessage, TBuilder>
    {
        private readonly EnumDescriptor enumDescriptor;

        internal SingleEnumAccessor(FieldDescriptor field, string name, string containingOneofName, bool supportFieldPresence)
            : base(field, name, containingOneofName, supportFieldPresence)
        {
            enumDescriptor = field.EnumType;
        }

        /// <summary>
        /// Returns an EnumValueDescriptor representing the value in the builder.
        /// Note that if an enum has multiple values for the same number, the descriptor
        /// for the first value with that number will be returned.
        /// </summary>
        public override object GetValue(TMessage message)
        {
            // Note: This relies on the fact that the CLR allows unboxing from an enum to
            // its underlying value
            int rawValue = (int) base.GetValue(message);
            return enumDescriptor.FindValueByNumber(rawValue);
        }

        /// <summary>
        /// Sets the value as an enum (via an int) in the builder,
        /// from an EnumValueDescriptor parameter.
        /// </summary>
        public override void SetValue(TBuilder builder, object value)
        {
            ThrowHelper.ThrowIfNull(value, "value");
            EnumValueDescriptor valueDescriptor = (EnumValueDescriptor) value;
            base.SetValue(builder, valueDescriptor.Number);
        }
    }
}


text:
'use strict';

TraceCtrl.controller('TraceDistChartCtrl', function($scope, $http) {

  $scope.page = {
    title: 'Trace Distribution'
  };
    $scope.loadData = function() {
    console.log('data is loading for getDistribution');
    $http.get('../trace/?action=getDistribution').
    success(function(data, status, headers, config) {
      console.log('recived the data');
      console.log(data);
      for(var i = 0; i < data.length; i++) {
        var datax = data[i];
        var datamodel =[{
            "v": datax.hostname
          }, {
            "v": parseFloat(datax.count)
          }]
        chartObject.data.rows[i] = {"c": datamodel
        }
      }
    }).
    error(function(data, status, headers, config) {
      console.log('error of loading timeline in start');
    });

    $scope.chartObject = chartObject;
  };

  $scope.setChartType = function(type) {
    $scope.chartObject.type = type;
  };

  $scope.chartObject = {};
  $scope.loadData();
  //$scope.chartObject = chartObject
});


text:
class PvBuffer;
class PvTruesenseConverter;

namespace PvBufferLib
{
    class Image;
    class Buffer;
}

class PV_BUFFER_API PvImage
{
public:

    const uint8_t *GetDataPointer() const;
    uint8_t *GetDataPointer();

    uint32_t GetWidth() const;
    uint32_t GetHeight() const;
    PvPixelType GetPixelType() const;
    uint32_t GetBitsPerPixel() const;

    static uint32_t GetPixelSize( PvPixelType aPixelType );
    static bool IsPixelColor( PvPixelType aPixelType );
    static bool IsPixelHighRes( PvPixelType aPixelType );
    static uint32_t GetBitsPerComponent(  PvPixelType aPixelType );

    uint32_t GetRequiredSize() const;
    uint32_t GetImageSize() const;
    uint32_t GetEffectiveImageSize() const;

    uint32_t GetOffsetX() const;
    uint32_t GetOffsetY() const;
    uint16_t GetPaddingX() const;
    uint16_t GetPaddingY() const;

    PvResult Alloc( uint32_t aSizeX, uint32_t aSizeY, PvPixelType aPixelType, uint16_t aPaddingX = 0, uint16_t aPaddingY = 0 );
	void Free();

    PvResult Attach( void * aRawBuffer, uint32_t aSizeX, uint32_t aSizeY, PvPixelType aPixelType, uint16_t aPaddingX = 0, uint16_t aPaddingY = 0 );
	uint8_t *Detach();

    bool IsPartialLineMissing() const;
    bool IsFullLineMissing() const;
    bool IsEOFByLineCount() const;
    bool IsInterlacedEven() const;
    bool IsInterlacedOdd() const;
    bool IsImageDropped() const;
    bool IsDataOverrun() const;

	PvBuffer *GetBuffer();

protected:

    PvImage( PvBufferLib::Image *aImage );
    virtual ~PvImage();

private:

	friend class PvBufferLib::Buffer;
	friend class PvTruesenseConverter;

    PvBufferLib::Image * mThis;

	// Not implemented
	PvImage( const PvImage & );
	const PvImage &operator=( const PvImage & );
};

#ifdef PV_INTERNAL_HEADERS
    #include <PvBufferLib/Buffer.h>
#endif // PV_INTERNAL_HEADERS

#endif // __PvImage_H__


text:
"""

Revision ID: 0315_document_download_count
Revises: 0314_populate_email_access
Create Date: 2020-02-12 14:19:18.066425

"""
import sqlalchemy as sa
from alembic import op

revision = "0315_document_download_count"
down_revision = "0314_populate_email_access"

def upgrade():
    op.add_column("notifications", sa.Column("document_download_count", sa.Integer(), nullable=True))
    op.add_column("notification_history", sa.Column("document_download_count", sa.Integer(), nullable=True))

def downgrade():
    op.drop_column("notifications", "document_download_count")
    op.drop_column("notification_history", "document_download_count")


text:
<!doctype html>
<html>

<head>
	<meta charset="UTF-8" />
	<title>hooked on a ceiling!</title>
	<script src="src/main.js"></script>
</head>

<body>

	<script type="text/javascript">
		window.onload = hooked.init();
	</script>

</body>

</html>


text:
<?php
/** Initernationalization

 * Translation plugin using ini files
 *
 * Require declaration of constants: LANGDIR, LANG.
 */

define('HOOK_GETLANG', 'getDomainLang');
Hook::create(HOOK_GETLANG);

/** Loads a language ini file

 * @param string $domain The domain of the file to load.
 *
 * Loads a language ini file from the file system.
 * You don't have to use this function explicitly.
 */
function loadLangFile($domain='global') {
	global $LANG, $APP_LANG;
	if( isset($LANG[$domain]) ) { return; }
	if( !isset($APP_LANG) ) {
		$APP_LANG	= Hook::trigger(HOOK_GETLANG, true, LANG, $domain);
	}
	if( !empty($domain) && existsPathOf(LANGDIR.'/'.$APP_LANG.'/'.$domain.'.ini') ) {
		$GLOBALS['LANG'][$domain] = parse_ini_file(pathOf(LANGDIR.'/'.$APP_LANG.'/'.$domain.'.ini'));

	} else if( existsPathOf(LANGDIR.'/'.$APP_LANG.'.ini') ) {
		$GLOBALS['LANG'] = parse_ini_file(pathOf(LANGDIR.'/'.$APP_LANG.'.ini'));
	}
}

/** Text function for translations.

 * @param string $k The Key to translate, prefer to use an internal language (English CamelCase).
 * @param string $domain The domain to apply the Key. Default value is 'global'.
 * @param array|string $values The values array to replace in text. Could be used as second parameter.
 * @return string The translated human text.
 *
 * This function try to translate the given key, in case of failure, it just returns the Key.
 * It tries to replace $values in text by key using \#key\# format using str_replace() but if $values is a list of values, it uses sprintf().
 * $values allows 3 formats:
 *  - array('key1'=>'value1', 'key2'=>'value2'...)
 *  - array(array('key1', 'key2'...), array('value1', 'value2'...))
 *  - array('value1', 'value2'...)
 *  This function is variadic, you can specify values with more scalar arguments.
 *
 *  Examples: t('untranslatedString', 'aDomain'), t('My already translated string'), t('untranslatedString', 'global', array('key1'=>'val1')), t('untranslatedString', 'global', 'val1', 60)
 */
function t($k, $domain='global', $values=array()) {
	global $LANG;
	if( is_array($domain) ) {
		$values = $domain;
		$domain = 'global';
	}
	$k	= "$k";
	$r	= hasTranslation($k, $domain) ? $LANG[$domain][$k] : $k;
	while( isset($r[0]) && $r[0]=='%' ) {
		$k = substr($r, 1);
		if( hasTranslation($k, $domain) ) {
			$r = $LANG[$domain][$k];
		} else {
			break;
		}
	}
	if( $values!==array() ) {
// 		debug($k.' - $values', $values);
		if( !is_array($values) ) {
			$values		= array_slice(func_get_args(), 2);
		}
		if( isset($values[0]) ) {
			if( !is_array($values[0]) ) {
				return vsprintf($r, $values);
			}
			$rkeys		= $values[0];
			$rvalues	= !empty($values[1]) ? $values[1] : '';
		} else {
// 			text('Mapping keys');
			$rkeys		= array_map(function ($v) { return "#{$v}#"; }, array_keys($values));
			$rvalues	= array_values($values);
// 			text($rkeys);
// 			text($rvalues);
		}
		$r = str_replace($rkeys, $rvalues, $r);
	}
	return $r;
}
function _t($k, $domain='global', $values=array()) {
	echo t($k, $domain, $values);
}

/** Checks if this key exists.

 * @param string $k The Key to translate, prefer to use an internal language (English CamelCase).
 * @param string $domain The domain to apply the Key. Default value is 'global'.
 * @return boolean True if the translation exists in this domain.
 *
 * This function checks if the key is known in the translation list.
 */
function hasTranslation($k, $domain='global') {
	global $LANG;
	loadLangFile($domain);
	return isset($LANG[$domain]) && isset($LANG[$domain][$k]);
}

/** Checks if this key exists.

 * @param string $k The Key to translate, prefer to use an internal language (English CamelCase).
 * @param string $default The default translation value to use.
 * @param string $domain The domain to apply the Key. Default value is 'global'.
 * @return string The translation
 *
 * This function translate the key without any fail.
 * If no translation is available, it uses the $default.
 */
function translate($k, $default, $domain='global') {
	return hasTranslation($k, $domain) ? t($k, $domain) : $default;
}

if( hasTranslation('locale') ) {
	setlocale(LC_ALL, t('locale'));
} else
if( defined('LOCALE') ) {
	setlocale(LC_ALL, LOCALE);
}

function tc($k) {
	if( hasTranslation($k) ) { return t($k); }
	global $LOCALECONV;
	if( !isset($LOCALECONV) ) {
		$LOCALECONV	= localeconv();
	}
	return isset($LOCALECONV[$k]) ? $LOCALECONV[$k] : null;
}

function sanitizeNumber($value) {
	return str_replace(array(tc('decimal_point'), tc('thousands_sep')), array('.', ''), $value);
}

// define('LOCALE_', 'decimal_point');


text:
// Copyright (c) 2012 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 "chrome/browser/about_flags.h"

#include <algorithm>
#include <iterator>
#include <map>
#include <set>
#include <utility>

#include "base/command_line.h"
#include "base/memory/singleton.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "cc/switches.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/user_metrics.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/google_chrome_strings.h"
#include "media/base/media_switches.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/switches.h"
#include "ui/gl/gl_switches.h"
#include "ui/surface/surface_switches.h"

#if defined(ENABLE_MESSAGE_CENTER)
#include "ui/message_center/message_center_switches.h"
#endif

#if defined(USE_ASH)
#include "ash/ash_switches.h"
#endif

#if defined(OS_CHROMEOS)
#include "chromeos/chromeos_switches.h"
#endif

using content::UserMetricsAction;

namespace about_flags {

// Macros to simplify specifying the type.
#define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
    Experiment::SINGLE_VALUE, \
    command_line_switch, switch_value, NULL, NULL, NULL, 0
#define SINGLE_VALUE_TYPE(command_line_switch) \
    SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
#define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \
                                            disable_switch, disable_value) \
    Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \
    disable_switch, disable_value, NULL, 3
#define ENABLE_DISABLE_VALUE_TYPE(enable_switch, disable_switch) \
    ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, "", disable_switch, "")
#define MULTI_VALUE_TYPE(choices) \
    Experiment::MULTI_VALUE, NULL, NULL, NULL, NULL, choices, arraysize(choices)

namespace {

const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsAndroid;
const unsigned kOsDesktop = kOsMac | kOsWin | kOsLinux | kOsCrOS;

// Adds a |StringValue| to |list| for each platform where |bitmask| indicates
// whether the experiment is available on that platform.
void AddOsStrings(unsigned bitmask, ListValue* list) {
  struct {
    unsigned bit;
    const char* const name;
  } kBitsToOs[] = {
    {kOsMac, "Mac"},
    {kOsWin, "Windows"},
    {kOsLinux, "Linux"},
    {kOsCrOS, "Chrome OS"},
    {kOsAndroid, "Android"},
  };
  for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kBitsToOs); ++i)
    if (bitmask & kBitsToOs[i].bit)
      list->Append(new StringValue(kBitsToOs[i].name));
}

const Experiment::Choice kOmniboxHistoryQuickProviderNewScoringChoices[] = {
  { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_AUTOMATIC, "", "" },
  { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_ENABLED,
    switches::kOmniboxHistoryQuickProviderNewScoring,
    switches::kOmniboxHistoryQuickProviderNewScoringEnabled },
  { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_DISABLED,
    switches::kOmniboxHistoryQuickProviderNewScoring,
    switches::kOmniboxHistoryQuickProviderNewScoringDisabled }
};

const Experiment::Choice
    kOmniboxHistoryQuickProviderReorderForInliningChoices[] = {
  { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_AUTOMATIC,
    "",
    "" },
  { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_ENABLED,
    switches::kOmniboxHistoryQuickProviderReorderForInlining,
    switches::kOmniboxHistoryQuickProviderReorderForInliningEnabled },
  { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_DISABLED,
    switches::kOmniboxHistoryQuickProviderReorderForInlining,
    switches::kOmniboxHistoryQuickProviderReorderForInliningDisabled }
};

const Experiment::Choice kOmniboxInlineHistoryQuickProviderChoices[] = {
  { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_AUTOMATIC, "", "" },
  { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_ALLOWED,
    switches::kOmniboxInlineHistoryQuickProvider,
    switches::kOmniboxInlineHistoryQuickProviderAllowed },
  { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_PROHIBITED,
    switches::kOmniboxInlineHistoryQuickProvider,
    switches::kOmniboxInlineHistoryQuickProviderProhibited }
};

const Experiment::Choice kEnableCompositingForFixedPositionChoices[] = {
  { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
  { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
    switches::kEnableCompositingForFixedPosition, ""},
  { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
    switches::kDisableCompositingForFixedPosition, ""},
  { IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_HIGH_DPI,
    switches::kEnableHighDpiCompositingForFixedPosition, ""}
};

const Experiment::Choice kGDIPresentChoices[] = {
  { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
  { IDS_FLAGS_PRESENT_WITH_GDI_FIRST_SHOW,
    switches::kDoFirstShowPresentWithGDI, ""},
  { IDS_FLAGS_PRESENT_WITH_GDI_ALL_SHOW,
    switches::kDoAllShowPresentWithGDI, ""}
};

const Experiment::Choice kTouchEventsChoices[] = {
  { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" },
  { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
    switches::kTouchEvents,
    switches::kTouchEventsEnabled },
  { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
    switches::kTouchEvents,
    switches::kTouchEventsDisabled }
};

const Experiment::Choice kTouchOptimizedUIChoices[] = {
  { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" },
  { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
    switches::kTouchOptimizedUI,
    switches::kTouchOptimizedUIEnabled },
  { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
    switches::kTouchOptimizedUI,
    switches::kTouchOptimizedUIDisabled }
};

const Experiment::Choice kNaClDebugMaskChoices[] = {
  { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
  // Secure shell can be used on ChromeOS for forwarding the TCP port opened by
  // debug stub to a remote machine. Since secure shell uses NaCl, we provide
  // an option to switch off its debugging.
  { IDS_NACL_DEBUG_MASK_CHOICE_EXCLUDE_UTILS,
      switches::kNaClDebugMask, "!*://*/*ssh_client.nmf" },
  { IDS_NACL_DEBUG_MASK_CHOICE_INCLUDE_DEBUG,
      switches::kNaClDebugMask, "*://*/*debug.nmf" }
};

#if defined(OS_CHROMEOS)
const Experiment::Choice kAshBootAnimationFunction[] = {
  { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
  { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION2,
    ash::switches::kAshBootAnimationFunction2, ""},
  { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION3,
    ash::switches::kAshBootAnimationFunction3, ""}
};

const Experiment::Choice kChromeCaptivePortalDetectionChoices[] = {
  { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""},
  { IDS_FLAGS_CHROME_CAPTIVE_PORTAL_DETECTOR,
    switches::kEnableChromeCaptivePortalDetector, ""},
  { IDS_FLAGS_SHILL_CAPTIVE_PORTAL_DETECTOR,
    switches::kDisableChromeCaptivePortalDetector, ""}
};
#endif

const Experiment::Choice kImplSidePaintingChoices[] = {
  { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
  { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
    cc::switches::kEnableImplSidePainting, ""},
  { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
    cc::switches::kDisableImplSidePainting, ""}
};

// RECORDING USER METRICS FOR FLAGS:
// -----------------------------------------------------------------------------
// The first line of the experiment is the internal name. If you'd like to
// gather statistics about the usage of your flag, you should append a marker
// comment to the end of the feature name, like so:
//   "my-special-feature",  // FLAGS:RECORD_UMA
//
// After doing that, run //chrome/tools/extract_actions.py (see instructions at
// the top of that file for details) to update the chromeactions.txt file, which
// will enable UMA to record your feature flag.
//
// After your feature has shipped under a flag, you can locate the metrics under
// the action name AboutFlags_internal-action-name. Actions are recorded once
// per startup, so you should divide this number by AboutFlags_StartupTick to
// get a sense of usage. Note that this will not be the same as number of users
// with a given feature enabled because users can quit and relaunch the
// application multiple times over a given time interval. The dashboard also
// shows you how many (metrics reporting) users have enabled the flag over the
// last seven days. However, note that this is not the same as the number of
// users who have the flag enabled, since enabling the flag happens once,
// whereas running with the flag enabled happens until the user flips the flag
// again.

// To add a new experiment add to the end of kExperiments. There are two
// distinct types of experiments:
// . SINGLE_VALUE: experiment is either on or off. Use the SINGLE_VALUE_TYPE
//   macro for this type supplying the command line to the macro.
// . MULTI_VALUE: a list of choices, the first of which should correspond to a
//   deactivated state for this lab (i.e. no command line option).  To specify
//   this type of experiment use the macro MULTI_VALUE_TYPE supplying it the
//   array of choices.
// See the documentation of Experiment for details on the fields.
//
// When adding a new choice, add it to the end of the list.
const Experiment kExperiments[] = {
#if defined(OS_ANDROID)
  {
     "enable-spdy-proxy-auth",
     IDS_FLAGS_ENABLE_SPDY_PROXY_AUTH_NAME,
     IDS_FLAGS_ENABLE_SPDY_PROXY_AUTH_DESCRIPTION,
     kOsAndroid,
     SINGLE_VALUE_TYPE(switches::kEnableSpdyProxyAuth)
  },
#endif
  {
    "expose-for-tabs",  // FLAGS:RECORD_UMA
    IDS_FLAGS_TABPOSE_NAME,
    IDS_FLAGS_TABPOSE_DESCRIPTION,
    kOsMac,
#if defined(OS_MACOSX)
    // The switch exists only on OS X.
    SINGLE_VALUE_TYPE(switches::kEnableExposeForTabs)
#else
    SINGLE_VALUE_TYPE("")
#endif
  },
  {
    "conflicting-modules-check",  // FLAGS:RECORD_UMA
    IDS_FLAGS_CONFLICTS_CHECK_NAME,
    IDS_FLAGS_CONFLICTS_CHECK_DESCRIPTION,
    kOsWin,
    SINGLE_VALUE_TYPE(switches::kConflictingModulesCheck)
  },
  {
    "cloud-print-proxy",  // FLAGS:RECORD_UMA
    IDS_FLAGS_CLOUD_PRINT_CONNECTOR_NAME,
    IDS_FLAGS_CLOUD_PRINT_CONNECTOR_DESCRIPTION,
    // For a Chrome build, we know we have a PDF plug-in on Windows, so it's
    // fully enabled.
    // Otherwise, where we know Windows could be working if a viable PDF
    // plug-in could be supplied, we'll keep the lab enabled. Mac and Linux
    // always have PDF rasterization available, so no flag needed there.
#if !defined(GOOGLE_CHROME_BUILD)
    kOsWin,
#else
    0,
#endif
    SINGLE_VALUE_TYPE(switches::kEnableCloudPrintProxy)
  },
#if defined(OS_WIN)
  {
    "print-raster",
    IDS_FLAGS_PRINT_RASTER_NAME,
    IDS_FLAGS_PRINT_RASTER_DESCRIPTION,
    kOsWin,
    SINGLE_VALUE_TYPE(switches::kPrintRaster)
  },
#endif  // OS_WIN
  {
    "crxless-web-apps",
    IDS_FLAGS_CRXLESS_WEB_APPS_NAME,
    IDS_FLAGS_CRXLESS_WEB_APPS_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableCrxlessWebApps)
  },
  {
    "ignore-gpu-blacklist",
    IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME,
    IDS_FLAGS_IGNORE_GPU_BLACKLIST_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kIgnoreGpuBlacklist)
  },
  {
    "force-compositing-mode-2",
    IDS_FLAGS_FORCE_COMPOSITING_MODE_NAME,
    IDS_FLAGS_FORCE_COMPOSITING_MODE_DESCRIPTION,
    kOsMac | kOsWin | kOsLinux,
    ENABLE_DISABLE_VALUE_TYPE(switches::kForceCompositingMode,
                              switches::kDisableForceCompositingMode)
  },
  {
    "threaded-compositing-mode",
    IDS_FLAGS_THREADED_COMPOSITING_MODE_NAME,
    IDS_FLAGS_THREADED_COMPOSITING_MODE_DESCRIPTION,
    kOsDesktop & ~kOsCrOS,
    ENABLE_DISABLE_VALUE_TYPE(switches::kEnableThreadedCompositing,
                              switches::kDisableThreadedCompositing)
  },
  {
    "force-accelerated-composited-scrolling",
     IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_NAME,
     IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_DESCRIPTION,
     kOsAll,
     ENABLE_DISABLE_VALUE_TYPE(switches::kEnableAcceleratedOverflowScroll,
                               switches::kDisableAcceleratedOverflowScroll)
  },
  {
    "present-with-GDI",
    IDS_FLAGS_PRESENT_WITH_GDI_NAME,
    IDS_FLAGS_PRESENT_WITH_GDI_DESCRIPTION,
    kOsWin,
    MULTI_VALUE_TYPE(kGDIPresentChoices)
  },
  {
    "disable-accelerated-2d-canvas",
    IDS_FLAGS_DISABLE_ACCELERATED_2D_CANVAS_NAME,
    IDS_FLAGS_DISABLE_ACCELERATED_2D_CANVAS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kDisableAccelerated2dCanvas)
  },
  {
    "disable-deferred-2d-canvas",
    IDS_FLAGS_DISABLE_DEFERRED_2D_CANVAS_NAME,
    IDS_FLAGS_DISABLE_DEFERRED_2D_CANVAS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kDisableDeferred2dCanvas)
  },
  {
    "disable-threaded-animation",
    IDS_FLAGS_DISABLE_THREADED_ANIMATION_NAME,
    IDS_FLAGS_DISABLE_THREADED_ANIMATION_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(cc::switches::kDisableThreadedAnimation)
  },
  {
    "composited-layer-borders",
    IDS_FLAGS_COMPOSITED_LAYER_BORDERS,
    IDS_FLAGS_COMPOSITED_LAYER_BORDERS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kShowCompositedLayerBorders)
  },
  {
    "show-fps-counter",
    IDS_FLAGS_SHOW_FPS_COUNTER,
    IDS_FLAGS_SHOW_FPS_COUNTER_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kShowFPSCounter)
  },
  {
    "accelerated-filters",
    IDS_FLAGS_ACCELERATED_FILTERS,
    IDS_FLAGS_ACCELERATED_FILTERS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kEnableAcceleratedFilters)
  },
  {
    "disable-gpu-vsync",
    IDS_FLAGS_DISABLE_GPU_VSYNC_NAME,
    IDS_FLAGS_DISABLE_GPU_VSYNC_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kDisableGpuVsync)
  },
  {
    "enable-webgl",
    IDS_FLAGS_ENABLE_WEBGL_NAME,
    IDS_FLAGS_ENABLE_WEBGL_DESCRIPTION,
    kOsAndroid,
#if defined(OS_ANDROID)
    SINGLE_VALUE_TYPE(switches::kEnableExperimentalWebGL)
#else
    SINGLE_VALUE_TYPE("")
#endif
  },
  {
    "disable-webgl",
    IDS_FLAGS_DISABLE_WEBGL_NAME,
    IDS_FLAGS_DISABLE_WEBGL_DESCRIPTION,
    kOsDesktop,
#if defined(OS_ANDROID)
    SINGLE_VALUE_TYPE("")
#else
    SINGLE_VALUE_TYPE(switches::kDisableExperimentalWebGL)
#endif
  },
  {
    "enable-webrtc",
    IDS_FLAGS_ENABLE_WEBRTC_NAME,
    IDS_FLAGS_ENABLE_WEBRTC_DESCRIPTION,
    kOsAndroid,
#if defined(OS_ANDROID)
    SINGLE_VALUE_TYPE(switches::kEnableWebRTC)
#else
    SINGLE_VALUE_TYPE("")
#endif
  },
  {
    "fixed-position-creates-stacking-context",
    IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_NAME,
    IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_DESCRIPTION,
    kOsAll,
    ENABLE_DISABLE_VALUE_TYPE(
        switches::kEnableFixedPositionCreatesStackingContext,
        switches::kDisableFixedPositionCreatesStackingContext)
  },
  {
    "enable-compositing-for-fixed-position",
    IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_NAME,
    IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_DESCRIPTION,
    kOsAll,
    MULTI_VALUE_TYPE(kEnableCompositingForFixedPositionChoices)
  },
  // TODO(bbudge): When NaCl is on by default, remove this flag entry.
  {
    "enable-nacl",  // FLAGS:RECORD_UMA
    IDS_FLAGS_ENABLE_NACL_NAME,
    IDS_FLAGS_ENABLE_NACL_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableNaCl)
  },
  // TODO(halyavin): When exception handling is on by default, replace this
  // flag with disable-nacl-exception-handling.
  {
    "enable-nacl-exception-handling",  // FLAGS:RECORD_UMA
    IDS_FLAGS_ENABLE_NACL_EXCEPTION_HANDLING_NAME,
    IDS_FLAGS_ENABLE_NACL_EXCEPTION_HANDLING_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableNaClExceptionHandling)
  },
  {
    "enable-nacl-debug",  // FLAGS:RECORD_UMA
    IDS_FLAGS_ENABLE_NACL_DEBUG_NAME,
    IDS_FLAGS_ENABLE_NACL_DEBUG_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableNaClDebug)
  },
  {
    "nacl-debug-mask",  // FLAGS:RECORD_UMA
    IDS_FLAGS_NACL_DEBUG_MASK_NAME,
    IDS_FLAGS_NACL_DEBUG_MASK_DESCRIPTION,
    kOsDesktop,
    MULTI_VALUE_TYPE(kNaClDebugMaskChoices)
  },
  {
    "enable-pnacl",  // FLAGS:RECORD_UMA
    IDS_FLAGS_ENABLE_PNACL_NAME,
    IDS_FLAGS_ENABLE_PNACL_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnablePnacl)
  },
  {
    "extension-apis",  // FLAGS:RECORD_UMA
    IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_NAME,
    IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableExperimentalExtensionApis)
  },
  {
    "action-box",
    IDS_FLAGS_ACTION_BOX_NAME,
    IDS_FLAGS_ACTION_BOX_DESCRIPTION,
    kOsDesktop,
    ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kActionBox, "1",
                                        switches::kActionBox, "0")
  },
  {
    "script-badges",
    IDS_FLAGS_SCRIPT_BADGES_NAME,
    IDS_FLAGS_SCRIPT_BADGES_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kScriptBadges)
  },
  {
    "script-bubble",
    IDS_FLAGS_SCRIPT_BUBBLE_NAME,
    IDS_FLAGS_SCRIPT_BUBBLE_DESCRIPTION,
    kOsDesktop,
    ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kScriptBubble, "1",
                                        switches::kScriptBubble, "0")
  },
  {
    "apps-new-install-bubble",
    IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_NAME,
    IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kAppsNewInstallBubble)
  },
  {
    "disable-hyperlink-auditing",
    IDS_FLAGS_DISABLE_HYPERLINK_AUDITING_NAME,
    IDS_FLAGS_DISABLE_HYPERLINK_AUDITING_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kNoPings)
  },
  {
    "experimental-location-features",  // FLAGS:RECORD_UMA
    IDS_FLAGS_EXPERIMENTAL_LOCATION_FEATURES_NAME,
    IDS_FLAGS_EXPERIMENTAL_LOCATION_FEATURES_DESCRIPTION,
    kOsMac | kOsWin | kOsLinux,  // Currently does nothing on CrOS.
    SINGLE_VALUE_TYPE(switches::kExperimentalLocationFeatures)
  },
  {
    "tab-groups-context-menu",
    IDS_FLAGS_TAB_GROUPS_CONTEXT_MENU_NAME,
    IDS_FLAGS_TAB_GROUPS_CONTEXT_MENU_DESCRIPTION,
    kOsWin,
    SINGLE_VALUE_TYPE(switches::kEnableTabGroupsContextMenu)
  },
  {
    "enable-instant-extended-api",
    IDS_FLAGS_ENABLE_INSTANT_EXTENDED_API,
    IDS_FLAGS_ENABLE_INSTANT_EXTENDED_API_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableInstantExtendedAPI)
  },
  {
    "static-ip-config",
    IDS_FLAGS_STATIC_IP_CONFIG_NAME,
    IDS_FLAGS_STATIC_IP_CONFIG_DESCRIPTION,
    kOsCrOS,
#if defined(OS_CHROMEOS)
    // This switch exists only on Chrome OS.
    SINGLE_VALUE_TYPE(switches::kEnableStaticIPConfig)
#else
    SINGLE_VALUE_TYPE("")
#endif
  },
  {
    "show-autofill-type-predictions",
    IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_NAME,
    IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kShowAutofillTypePredictions)
  },
  {
    "sync-tab-favicons",
    IDS_FLAGS_SYNC_TAB_FAVICONS_NAME,
    IDS_FLAGS_SYNC_TAB_FAVICONS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kSyncTabFavicons)
  },
  {
    "sync-app-notifications",
    IDS_FLAGS_SYNC_APP_NOTIFICATIONS_NAME,
    IDS_FLAGS_SYNC_APP_NOTIFICATIONS_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kDisableSyncAppNotifications)
  },
  {
    "sync-keystore-encryption",
    IDS_FLAGS_SYNC_KEYSTORE_ENCRYPTION_NAME,
    IDS_FLAGS_SYNC_KEYSTORE_ENCRYPTION_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kSyncKeystoreEncryption)
  },
  {
    "enable-gesture-tap-highlight",
    IDS_FLAGS_ENABLE_GESTURE_TAP_HIGHLIGHTING_NAME,
    IDS_FLAGS_ENABLE_GESTURE_TAP_HIGHLIGHTING_DESCRIPTION,
    kOsLinux | kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableGestureTapHighlight)
  },
  {
    "enable-smooth-scrolling",  // FLAGS:RECORD_UMA
    IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_NAME,
    IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_DESCRIPTION,
    // Can't expose the switch unless the code is compiled in.
    // On by default for the Mac (different implementation in WebKit).
    kOsWin | kOsLinux,
    SINGLE_VALUE_TYPE(switches::kEnableSmoothScrolling)
  },
  {
    "omnibox-history-quick-provider-new-scoring",
    IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_NAME,
    IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_DESCRIPTION,
    kOsAll,
    MULTI_VALUE_TYPE(kOmniboxHistoryQuickProviderNewScoringChoices)
  },
  {
    "omnibox-history-quick-provider-reorder-for-inlining",
    IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_NAME,
    IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_DESCRIPTION,
    kOsAll,
    MULTI_VALUE_TYPE(kOmniboxHistoryQuickProviderReorderForInliningChoices)
  },
  {
    "omnibox-inline-history-quick-provider",
    IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_NAME,
    IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_DESCRIPTION,
    kOsAll,
    MULTI_VALUE_TYPE(kOmniboxInlineHistoryQuickProviderChoices)
  },
  {
    "enable-panels",
    IDS_FLAGS_ENABLE_PANELS_NAME,
    IDS_FLAGS_ENABLE_PANELS_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnablePanels)
  },
  {
    "enable-panel-stacking",
    IDS_FLAGS_ENABLE_PANEL_STACKING_NAME,
    IDS_FLAGS_ENABLE_PANEL_STACKING_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnablePanelStacking)
  },
  {
    // See http://crbug.com/120416 for how to remove this flag.
    "save-page-as-mhtml",  // FLAGS:RECORD_UMA
    IDS_FLAGS_SAVE_PAGE_AS_MHTML_NAME,
    IDS_FLAGS_SAVE_PAGE_AS_MHTML_DESCRIPTION,
    kOsMac | kOsWin | kOsLinux,
    SINGLE_VALUE_TYPE(switches::kSavePageAsMHTML)
  },
  {
    "enable-autologin",
    IDS_FLAGS_ENABLE_AUTOLOGIN_NAME,
    IDS_FLAGS_ENABLE_AUTOLOGIN_DESCRIPTION,
    kOsMac | kOsWin | kOsLinux,
    SINGLE_VALUE_TYPE(switches::kEnableAutologin)
  },
  {
    "enable-spdy3",
    IDS_FLAGS_ENABLE_SPDY3_NAME,
    IDS_FLAGS_ENABLE_SPDY3_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kEnableSpdy3)
  },
  {
    "enable-async-dns",
    IDS_FLAGS_ENABLE_ASYNC_DNS_NAME,
    IDS_FLAGS_ENABLE_ASYNC_DNS_DESCRIPTION,
    kOsWin | kOsMac | kOsLinux | kOsCrOS,
    ENABLE_DISABLE_VALUE_TYPE(switches::kEnableAsyncDns,
                              switches::kDisableAsyncDns)
  },
  {
    "disable-media-source",
    IDS_FLAGS_DISABLE_MEDIA_SOURCE_NAME,
    IDS_FLAGS_DISABLE_MEDIA_SOURCE_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kDisableMediaSource)
  },
  {
    "disable-encrypted-media",
    IDS_FLAGS_DISABLE_ENCRYPTED_MEDIA_NAME,
    IDS_FLAGS_DISABLE_ENCRYPTED_MEDIA_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kDisableEncryptedMedia)
  },
  {
    "enable-opus-playback",
    IDS_FLAGS_ENABLE_OPUS_PLAYBACK_NAME,
    IDS_FLAGS_ENABLE_OPUS_PLAYBACK_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableOpusPlayback)
  },
  {
    "enable-vp9-playback",
    IDS_FLAGS_ENABLE_VP9_PLAYBACK_NAME,
    IDS_FLAGS_ENABLE_VP9_PLAYBACK_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableVp9Playback)
  },
  {
    "enable-managed-users",
    IDS_FLAGS_ENABLE_LOCALLY_MANAGED_USERS_NAME,
    IDS_FLAGS_ENABLE_LOCALLY_MANAGED_USERS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kEnableManagedUsers)
  },
#if defined(USE_ASH)
  {
    "ash-disable-auto-window-placement",
    IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_NAME,
    IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_DESCRIPTION,
    kOsWin | kOsLinux | kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshDisableAutoWindowPlacement)
  },
  {
    "ash-disable-per-app-launcher",
    IDS_FLAGS_ASH_DISABLE_PER_APP_LAUNCHER_NAME,
    IDS_FLAGS_ASH_DISABLE_PER_APP_LAUNCHER_DESCRIPTION,
    kOsWin | kOsLinux | kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshDisablePerAppLauncher)
  },
#endif
  {
    "per-tile-painting",
    IDS_FLAGS_PER_TILE_PAINTING_NAME,
    IDS_FLAGS_PER_TILE_PAINTING_DESCRIPTION,
#if defined(USE_SKIA)
    kOsMac | kOsLinux | kOsCrOS,
#else
    0,
#endif
    SINGLE_VALUE_TYPE(cc::switches::kEnablePerTilePainting)
  },
  {
    "enable-javascript-harmony",
    IDS_FLAGS_ENABLE_JAVASCRIPT_HARMONY_NAME,
    IDS_FLAGS_ENABLE_JAVASCRIPT_HARMONY_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE_AND_VALUE(switches::kJavaScriptFlags, "--harmony")
  },
  {
    "enable-tab-browser-dragging",
    IDS_FLAGS_ENABLE_TAB_BROWSER_DRAGGING_NAME,
    IDS_FLAGS_ENABLE_TAB_BROWSER_DRAGGING_DESCRIPTION,
    kOsWin,
    SINGLE_VALUE_TYPE(switches::kTabBrowserDragging)
  },
  {
    "disable-restore-session-state",
    IDS_FLAGS_DISABLE_RESTORE_SESSION_STATE_NAME,
    IDS_FLAGS_DISABLE_RESTORE_SESSION_STATE_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kDisableRestoreSessionState)
  },
  {
    "disable-software-rasterizer",
    IDS_FLAGS_DISABLE_SOFTWARE_RASTERIZER_NAME,
    IDS_FLAGS_DISABLE_SOFTWARE_RASTERIZER_DESCRIPTION,
#if defined(ENABLE_SWIFTSHADER)
    kOsAll,
#else
    0,
#endif
    SINGLE_VALUE_TYPE(switches::kDisableSoftwareRasterizer)
  },
  {
    "enable-experimental-webkit-features",
    IDS_FLAGS_EXPERIMENTAL_WEBKIT_FEATURES_NAME,
    IDS_FLAGS_EXPERIMENTAL_WEBKIT_FEATURES_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kEnableExperimentalWebKitFeatures)
  },
  {
    "enable-css-shaders",
    IDS_FLAGS_CSS_SHADERS_NAME,
    IDS_FLAGS_CSS_SHADERS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kEnableCssShaders)
  },
  {
    "enable-extension-activity-ui",
    IDS_FLAGS_ENABLE_EXTENSION_ACTIVITY_UI_NAME,
    IDS_FLAGS_ENABLE_EXTENSION_ACTIVITY_UI_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableExtensionActivityUI)
  },
  {
    "disable-ntp-other-sessions-menu",
    IDS_FLAGS_NTP_OTHER_SESSIONS_MENU_NAME,
    IDS_FLAGS_NTP_OTHER_SESSIONS_MENU_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kDisableNTPOtherSessionsMenu)
  },
#if defined(USE_ASH)
  {
    "enable-ash-oak",
    IDS_FLAGS_ENABLE_ASH_OAK_NAME,
    IDS_FLAGS_ENABLE_ASH_OAK_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(ash::switches::kAshEnableOak),
  },
#endif
  {
    "enable-devtools-experiments",
    IDS_FLAGS_ENABLE_DEVTOOLS_EXPERIMENTS_NAME,
    IDS_FLAGS_ENABLE_DEVTOOLS_EXPERIMENTS_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableDevToolsExperiments)
  },
  {
    "enable-suggestions-ntp",
    IDS_FLAGS_NTP_SUGGESTIONS_PAGE_NAME,
    IDS_FLAGS_NTP_SUGGESTIONS_PAGE_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableSuggestionsTabPage)
  },
  {
    "spellcheck-autocorrect",
    IDS_FLAGS_SPELLCHECK_AUTOCORRECT,
    IDS_FLAGS_SPELLCHECK_AUTOCORRECT_DESCRIPTION,
    kOsWin | kOsLinux | kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableSpellingAutoCorrect)
  },
  {
    "touch-events",
    IDS_TOUCH_EVENTS_NAME,
    IDS_TOUCH_EVENTS_DESCRIPTION,
    kOsDesktop,
    MULTI_VALUE_TYPE(kTouchEventsChoices)
  },
  {
    "touch-optimized-ui",
    IDS_FLAGS_TOUCH_OPTIMIZED_UI_NAME,
    IDS_FLAGS_TOUCH_OPTIMIZED_UI_DESCRIPTION,
    kOsWin,
    MULTI_VALUE_TYPE(kTouchOptimizedUIChoices)
  },
  {
    "enable-webkit-text-subpixel-positioning",
    IDS_FLAGS_ENABLE_WEBKIT_TEXT_SUBPIXEL_POSITIONING_NAME,
    IDS_FLAGS_ENABLE_WEBKIT_TEXT_SUBPIXEL_POSITIONING_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(gfx::switches::kEnableWebkitTextSubpixelPositioning)
  },
  {
    "disable-touch-adjustment",
    IDS_DISABLE_TOUCH_ADJUSTMENT_NAME,
    IDS_DISABLE_TOUCH_ADJUSTMENT_DESCRIPTION,
    kOsWin | kOsLinux | kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kDisableTouchAdjustment)
  },
  {
    "enable-tab-capture",
    IDS_ENABLE_TAB_CAPTURE_NAME,
    IDS_ENABLE_TAB_CAPTURE_DESCRIPTION,
    kOsWin | kOsMac | kOsLinux | kOsCrOS,
    ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kTabCapture, "1",
                                        switches::kTabCapture, "0")
  },
#if defined(OS_CHROMEOS)
  {
    "enable-background-loader",
    IDS_ENABLE_BACKLOADER_NAME,
    IDS_ENABLE_BACKLOADER_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableBackgroundLoader)
  },
  {
    "enable-bezel-touch",
    IDS_ENABLE_BEZEL_TOUCH_NAME,
    IDS_ENABLE_BEZEL_TOUCH_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableBezelTouch)
  },
  {
    "enable-screensaver-extension",
    IDS_ENABLE_SCREENSAVER_EXTENSION_NAME,
    IDS_ENABLE_SCREENSAVER_EXTENSION_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(chromeos::switches::kEnableScreensaverExtensions)
  },
  {
    "no-discard-tabs",
    IDS_FLAGS_NO_DISCARD_TABS_NAME,
    IDS_FLAGS_NO_DISCARD_TABS_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kNoDiscardTabs)
  },
#endif
  {
    "enable-download-resumption",
    IDS_FLAGS_ENABLE_DOWNLOAD_RESUMPTION_NAME,
    IDS_FLAGS_ENABLE_DOWNLOAD_RESUMPTION_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableDownloadResumption)
  },
  {
    "allow-nacl-socket-api",
    IDS_FLAGS_ALLOW_NACL_SOCKET_API_NAME,
    IDS_FLAGS_ALLOW_NACL_SOCKET_API_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE_AND_VALUE(switches::kAllowNaClSocketAPI, "*")
  },
  {
    "stacked-tab-strip",
    IDS_FLAGS_STACKED_TAB_STRIP_NAME,
    IDS_FLAGS_STACKED_TAB_STRIP_DESCRIPTION,
    kOsWin,
    SINGLE_VALUE_TYPE(switches::kEnableStackedTabStrip)
  },
  {
    "force-device-scale-factor",
    IDS_FLAGS_FORCE_HIGH_DPI_NAME,
    IDS_FLAGS_FORCE_HIGH_DPI_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE_AND_VALUE(switches::kForceDeviceScaleFactor, "2")
  },
#if defined(OS_CHROMEOS)
  {
    "allow-touchpad-three-finger-click",
    IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_CLICK_NAME,
    IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_CLICK_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableTouchpadThreeFingerClick)
  },
  {
    "allow-touchpad-three-finger-swipe",
    IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_SWIPE_NAME,
    IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_SWIPE_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableTouchpadThreeFingerSwipe)
  },
#endif
  {
    "use-client-login-signin-flow",
    IDS_FLAGS_USE_CLIENT_LOGIN_SIGNIN_FLOW_NAME,
    IDS_FLAGS_USE_CLIENT_LOGIN_SIGNIN_FLOW_DESCRIPTION,
    kOsMac | kOsWin | kOsLinux,
    SINGLE_VALUE_TYPE(switches::kUseClientLoginSigninFlow)
  },
  {
    "enable-desktop-guest-mode",
    IDS_FLAGS_DESKTOP_GUEST_MODE_NAME,
    IDS_FLAGS_DESKTOP_GUEST_MODE_DESCRIPTION,
    kOsMac | kOsWin | kOsLinux,
    SINGLE_VALUE_TYPE(switches::kEnableDesktopGuestMode)
  },
#if defined(USE_ASH)
  {
    "show-launcher-alignment-menu",
    IDS_FLAGS_SHOW_LAUNCHER_ALIGNMENT_MENU_NAME,
    IDS_FLAGS_SHOW_LAUNCHER_ALIGNMENT_MENU_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kShowLauncherAlignmentMenu)
  },
  {
    "show-touch-hud",
    IDS_FLAGS_SHOW_TOUCH_HUD_NAME,
    IDS_FLAGS_SHOW_TOUCH_HUD_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(ash::switches::kAshTouchHud)
  },
  {
    "enable-pinch",
    IDS_FLAGS_ENABLE_PINCH_SCALE_NAME,
    IDS_FLAGS_ENABLE_PINCH_SCALE_DESCRIPTION,
    kOsLinux | kOsWin | kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnablePinch),
  },
  {
    "app-list-show-apps-only",
    IDS_FLAGS_ENABLE_APP_LIST_SHOW_APPS_ONLY_NAME,
    IDS_FLAGS_ENABLE_APP_LIST_SHOW_APPS_ONLY_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(app_list::switches::kAppListShowAppsOnly),
  },
#endif  // defined(USE_ASH)
#if defined(OS_CHROMEOS)
  {
    "disable-boot-animation",
    IDS_FLAGS_DISABLE_BOOT_ANIMATION,
    IDS_FLAGS_DISABLE_BOOT_ANIMATION_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kDisableBootAnimation),
  },
  {
    "disable-boot-animation2",
    IDS_FLAGS_DISABLE_BOOT_ANIMATION2,
    IDS_FLAGS_DISABLE_BOOT_ANIMATION2_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshDisableBootAnimation2),
  },
  {
    "boot-animation-fucntion",
    IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION,
    IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION_DESCRIPTION,
    kOsCrOS,
    MULTI_VALUE_TYPE(kAshBootAnimationFunction),
  },
  {
    "captive-portal-detector",
    IDS_FLAGS_CAPTIVE_PORTAL_DETECTOR_NAME,
    IDS_FLAGS_CAPTIVE_PORTAL_DETECTOR_DESCRIPTION,
    kOsCrOS,
    MULTI_VALUE_TYPE(kChromeCaptivePortalDetectionChoices),
  },
  {
    "disable-new-lock-animations",
    IDS_FLAGS_ASH_NEW_LOCK_ANIMATIONS,
    IDS_FLAGS_ASH_NEW_LOCK_ANIMATIONS_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshDisableNewLockAnimations),
  },
  {
    "file-manager-packaged",
    IDS_FLAGS_FILE_MANAGER_PACKAGED_NAME,
    IDS_FLAGS_FILE_MANAGER_PACKAGED_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kFileManagerPackaged),
  },
  {
    "disable-launcher-per-display",
    IDS_FLAGS_DISABLE_LAUNCHER_PER_DISPLAY_NAME,
    IDS_FLAGS_DISABLE_LAUNCHER_PER_DISPLAY_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshDisableLauncherPerDisplay),
  },
  {
    "enable-app-mode",
    IDS_FLAGS_ENABLE_KIOSK_APPS_NAME,
    IDS_FLAGS_ENABLE_KIOSK_APPS_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableAppMode),
  },
#endif  // defined(OS_CHROMEOS)
  {
    "enable-views-textfield",
    IDS_FLAGS_ENABLE_VIEWS_TEXTFIELD_NAME,
    IDS_FLAGS_ENABLE_VIEWS_TEXTFIELD_DESCRIPTION,
    kOsWin,
    SINGLE_VALUE_TYPE(switches::kEnableViewsTextfield),
  },
  {
    "old-checkbox-style",
    IDS_FLAGS_OLD_CHECKBOX_STYLE,
    IDS_FLAGS_OLD_CHECKBOX_STYLE_DESCRIPTION,
    kOsLinux | kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kOldCheckboxStyle),
  },
  {
    "enable-new-dialog-style",
    IDS_FLAGS_ENABLE_NEW_DIALOG_STYLE_NAME,
    IDS_FLAGS_ENABLE_NEW_DIALOG_STYLE_DESCRIPTION,
    kOsWin | kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableNewDialogStyle),
  },
  { "disable-accelerated-video-decode",
    IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_NAME,
    IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode),
  },
#if defined(USE_ASH)
  {
    "ash-debug-shortcuts",
    IDS_FLAGS_DEBUG_SHORTCUTS_NAME,
    IDS_FLAGS_DEBUG_SHORTCUTS_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(ash::switches::kAshDebugShortcuts),
  },
#endif
  {
    "enable-webaudio-input",
    IDS_FLAGS_ENABLE_WEBAUDIO_INPUT_NAME,
    IDS_FLAGS_ENABLE_WEBAUDIO_INPUT_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableWebAudioInput),
  },
  {
    "enable-contacts",
    IDS_FLAGS_ENABLE_CONTACTS_NAME,
    IDS_FLAGS_ENABLE_CONTACTS_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableContacts)
  },
#if defined(USE_ASH)
  { "ash-enable-advanced-gestures",
    IDS_FLAGS_ENABLE_ADVANCED_GESTURES_NAME,
    IDS_FLAGS_ENABLE_ADVANCED_GESTURES_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshEnableAdvancedGestures),
  },
  { "ash-disable-tab-scrubbing",
    IDS_FLAGS_DISABLE_TAB_SCRUBBING_NAME,
    IDS_FLAGS_DISABLE_TAB_SCRUBBING_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kAshDisableTabScrubbing),
  },
  { "ash-enable-workspace-scrubbing",
    IDS_FLAGS_ENABLE_WORKSPACE_SCRUBBING_NAME,
    IDS_FLAGS_ENABLE_WORKSPACE_SCRUBBING_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshEnableWorkspaceScrubbing),
  },
  { "ash-immersive-mode",
    IDS_FLAGS_ASH_IMMERSIVE_MODE_NAME,
    IDS_FLAGS_ASH_IMMERSIVE_MODE_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshImmersiveMode),
  },
#if defined(OS_LINUX)
  { "ash-enable-memory-monitor",
      IDS_FLAGS_ENABLE_MEMORY_MONITOR_NAME,
      IDS_FLAGS_ENABLE_MEMORY_MONITOR_DESCRIPTION,
      kOsCrOS,
      SINGLE_VALUE_TYPE(ash::switches::kAshEnableMemoryMonitor),
  },
#endif
#endif
#if defined(OS_CHROMEOS)
  { "ash-enable-new-network-status-area",
    IDS_FLAGS_ASH_ENABLE_NEW_NETWORK_STATUS_AREA_NAME,
    IDS_FLAGS_ASH_ENABLE_NEW_NETWORK_STATUS_AREA_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(ash::switches::kAshEnableNewNetworkStatusArea),
  },
  {
    "enable-carrier-switching",
    IDS_FLAGS_ENABLE_CARRIER_SWITCHING,
    IDS_FLAGS_ENABLE_CARRIER_SWITCHING_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableCarrierSwitching)
  },
  {
    "enable-request-tablet-site",
    IDS_FLAGS_ENABLE_REQUEST_TABLET_SITE_NAME,
    IDS_FLAGS_ENABLE_REQUEST_TABLET_SITE_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableRequestTabletSite)
  },
#endif
  {
    "debug-packed-apps",
    IDS_FLAGS_DEBUG_PACKED_APP_NAME,
    IDS_FLAGS_DEBUG_PACKED_APP_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kDebugPackedApps)
  },
  {
    "enable-password-generation",
    IDS_FLAGS_ENABLE_PASSWORD_GENERATION_NAME,
    IDS_FLAGS_ENABLE_PASSWORD_GENERATION_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnablePasswordGeneration)
  },
  {
    "crash-on-gpu-hang",
    IDS_FLAGS_CRASH_ON_GPU_HANG_NAME,
    IDS_FLAGS_CRASH_ON_GPU_HANG_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kCrashOnGpuHang)
  },
  {
    "enable-deferred-image-decoding",
    IDS_FLAGS_ENABLE_DEFERRED_IMAGE_DECODING_NAME,
    IDS_FLAGS_ENABLE_DEFERRED_IMAGE_DECODING_DESCRIPTION,
#if defined(USE_SKIA)
    kOsMac | kOsLinux | kOsCrOS,
#else
    0,
#endif
    SINGLE_VALUE_TYPE(switches::kEnableDeferredImageDecoding)
  },
  {
    "performance-monitor-gathering",
    IDS_FLAGS_PERFORMANCE_MONITOR_GATHERING_NAME,
    IDS_FLAGS_PERFORMANCE_MONITOR_GATHERING_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kPerformanceMonitorGathering)
  },
  {
    "disable-native-autofill-ui",
    IDS_FLAGS_DISABLE_NATIVE_AUTOFILL_UI_NAME,
    IDS_FLAGS_DISABLE_NATIVE_AUTOFILL_UI_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kDisableNativeAutofillUi)
  },
  {
    "show-app-list-shortcut",
    IDS_FLAGS_SHOW_APP_LIST_SHORTCUT_NAME,
    IDS_FLAGS_SHOW_APP_LIST_SHORTCUT_DESCRIPTION,
    kOsWin,
    SINGLE_VALUE_TYPE(switches::kShowAppListShortcut)
  },
  {
    "enable-experimental-form-filling",
    IDS_FLAGS_ENABLE_EXPERIMENTAL_FORM_FILLING_NAME,
    IDS_FLAGS_ENABLE_EXPERIMENTAL_FORM_FILLING_DESCRIPTION,
    kOsWin | kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableExperimentalFormFilling)
  },
  {
    "enable-interactive-autocomplete",
    IDS_FLAGS_ENABLE_INTERACTIVE_AUTOCOMPLETE_NAME,
    IDS_FLAGS_ENABLE_INTERACTIVE_AUTOCOMPLETE_DESCRIPTION,
    kOsWin | kOsCrOS | kOsAndroid,
    SINGLE_VALUE_TYPE(switches::kEnableInteractiveAutocomplete)
  },
#if defined(USE_AURA)
  {
    "enable-overscroll-history-navigation",
    IDS_FLAGS_ENABLE_OVERSCROLL_HISTORY_NAVIGATION_NAME,
    IDS_FLAGS_ENABLE_OVERSCROLL_HISTORY_NAVIGATION_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kEnableOverscrollHistoryNavigation)
  },
#endif
  {
    "enable-touch-drag-drop",
    IDS_FLAGS_ENABLE_TOUCH_DRAG_DROP_NAME,
    IDS_FLAGS_ENABLE_TOUCH_DRAG_DROP_DESCRIPTION,
    kOsWin | kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableTouchDragDrop)
  },
  {
    "enable-touch-editing",
    IDS_FLAGS_ENABLE_TOUCH_EDITING_NAME,
    IDS_FLAGS_ENABLE_TOUCH_EDITING_DESCRIPTION,
    kOsCrOS,
    SINGLE_VALUE_TYPE(switches::kEnableTouchEditing)
  },
#if defined(ENABLE_MESSAGE_CENTER)
  {
    "enable-rich-notifications",
    IDS_FLAGS_ENABLE_RICH_NOTIFICATIONS_NAME,
    IDS_FLAGS_ENABLE_RICH_NOTIFICATIONS_DESCRIPTION,
    kOsWin | kOsCrOS,
    SINGLE_VALUE_TYPE(message_center::switches::kEnableRichNotifications)
  },
#endif
  {
    "full-history-sync",
    IDS_FLAGS_FULL_HISTORY_SYNC_NAME,
    IDS_FLAGS_FULL_HISTORY_SYNC_DESCRIPTION,
    kOsAll,
    SINGLE_VALUE_TYPE(switches::kHistoryEnableFullHistorySync)
  },
  {
    "enable-usermedia-screen-capture",
    IDS_FLAGS_ENABLE_SCREEN_CAPTURE_NAME,
    IDS_FLAGS_ENABLE_SCREEN_CAPTURE_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kEnableUserMediaScreenCapturing)
  },
  {
    "enable-apps-devtool-app",
    IDS_FLAGS_ENABLE_APPS_DEVTOOL_APP_NAME,
    IDS_FLAGS_ENABLE_APPS_DEVTOOL_APP_DESCRIPTION,
    kOsDesktop,
    SINGLE_VALUE_TYPE(switches::kAppsDevtool)
  },
  {
    "impl-side-painting",
    IDS_FLAGS_IMPL_SIDE_PAINTING_NAME,
    IDS_FLAGS_IMPL_SIDE_PAINTING_DESCRIPTION,
    kOsAndroid,
    MULTI_VALUE_TYPE(kImplSidePaintingChoices)
  },
};

const Experiment* experiments = kExperiments;
size_t num_experiments = arraysize(kExperiments);

// Stores and encapsulates the little state that about:flags has.
class FlagsState {
 public:
  FlagsState() : needs_restart_(false) {}
  void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line);
  bool IsRestartNeededToCommitChanges();
  void SetExperimentEnabled(
      PrefService* prefs, const std::string& internal_name, bool enable);
  void RemoveFlagsSwitches(
      std::map<std::string, CommandLine::StringType>* switch_list);
  void ResetAllFlags(PrefService* prefs);
  void reset();

  // Returns the singleton instance of this class
  static FlagsState* GetInstance() {
    return Singleton<FlagsState>::get();
  }

 private:
  bool needs_restart_;
  std::map<std::string, std::string> flags_switches_;

  DISALLOW_COPY_AND_ASSIGN(FlagsState);
};

// Extracts the list of enabled lab experiments from preferences and stores them
// in a set.
void GetEnabledFlags(const PrefService* prefs, std::set<std::string>* result) {
  const ListValue* enabled_experiments = prefs->GetList(
      prefs::kEnabledLabsExperiments);
  if (!enabled_experiments)
    return;

  for (ListValue::const_iterator it = enabled_experiments->begin();
       it != enabled_experiments->end();
       ++it) {
    std::string experiment_name;
    if (!(*it)->GetAsString(&experiment_name)) {
      LOG(WARNING) << "Invalid entry in " << prefs::kEnabledLabsExperiments;
      continue;
    }
    result->insert(experiment_name);
  }
}

// Takes a set of enabled lab experiments
void SetEnabledFlags(
    PrefService* prefs, const std::set<std::string>& enabled_experiments) {
  ListPrefUpdate update(prefs, prefs::kEnabledLabsExperiments);
  ListValue* experiments_list = update.Get();

  experiments_list->Clear();
  for (std::set<std::string>::const_iterator it = enabled_experiments.begin();
       it != enabled_experiments.end();
       ++it) {
    experiments_list->Append(new StringValue(*it));
  }
}

// Adds the internal names for the specified experiment to |names|.
void AddInternalName(const Experiment& e, std::set<std::string>* names) {
  if (e.type == Experiment::SINGLE_VALUE) {
    names->insert(e.internal_name);
  } else {
    DCHECK(e.type == Experiment::MULTI_VALUE ||
           e.type == Experiment::ENABLE_DISABLE_VALUE);
    for (int i = 0; i < e.num_choices; ++i)
      names->insert(e.NameForChoice(i));
  }
}

// Confirms that an experiment is valid, used in a DCHECK in
// SanitizeList below.
bool ValidateExperiment(const Experiment& e) {
  switch (e.type) {
    case Experiment::SINGLE_VALUE:
      DCHECK_EQ(0, e.num_choices);
      DCHECK(!e.choices);
      break;
    case Experiment::MULTI_VALUE:
      DCHECK_GT(e.num_choices, 0);
      DCHECK(e.choices);
      DCHECK(e.choices[0].command_line_switch);
      DCHECK_EQ('\0', e.choices[0].command_line_switch[0]);
      break;
    case Experiment::ENABLE_DISABLE_VALUE:
      DCHECK_EQ(3, e.num_choices);
      DCHECK(!e.choices);
      DCHECK(e.command_line_switch);
      DCHECK(e.command_line_value);
      DCHECK(e.disable_command_line_switch);
      DCHECK(e.disable_command_line_value);
      break;
    default:
      NOTREACHED();
  }
  return true;
}

// Removes all experiments from prefs::kEnabledLabsExperiments that are
// unknown, to prevent this list to become very long as experiments are added
// and removed.
void SanitizeList(PrefService* prefs) {
  std::set<std::string> known_experiments;
  for (size_t i = 0; i < num_experiments; ++i) {
    DCHECK(ValidateExperiment(experiments[i]));
    AddInternalName(experiments[i], &known_experiments);
  }

  std::set<std::string> enabled_experiments;
  GetEnabledFlags(prefs, &enabled_experiments);

  std::set<std::string> new_enabled_experiments;
  std::set_intersection(
      known_experiments.begin(), known_experiments.end(),
      enabled_experiments.begin(), enabled_experiments.end(),
      std::inserter(new_enabled_experiments, new_enabled_experiments.begin()));

  if (new_enabled_experiments != enabled_experiments)
    SetEnabledFlags(prefs, new_enabled_experiments);
}

void GetSanitizedEnabledFlags(
    PrefService* prefs, std::set<std::string>* result) {
  SanitizeList(prefs);
  GetEnabledFlags(prefs, result);
}

// Variant of GetSanitizedEnabledFlags that also removes any flags that aren't
// enabled on the current platform.
void GetSanitizedEnabledFlagsForCurrentPlatform(
    PrefService* prefs, std::set<std::string>* result) {
  GetSanitizedEnabledFlags(prefs, result);

  // Filter out any experiments that aren't enabled on the current platform.  We
  // don't remove these from prefs else syncing to a platform with a different
  // set of experiments would be lossy.
  std::set<std::string> platform_experiments;
  int current_platform = GetCurrentPlatform();
  for (size_t i = 0; i < num_experiments; ++i) {
    if (experiments[i].supported_platforms & current_platform)
      AddInternalName(experiments[i], &platform_experiments);
  }

  std::set<std::string> new_enabled_experiments;
  std::set_intersection(
      platform_experiments.begin(), platform_experiments.end(),
      result->begin(), result->end(),
      std::inserter(new_enabled_experiments, new_enabled_experiments.begin()));

  result->swap(new_enabled_experiments);
}

// Returns the Value representing the choice data in the specified experiment.
Value* CreateChoiceData(const Experiment& experiment,
                        const std::set<std::string>& enabled_experiments) {
  DCHECK(experiment.type == Experiment::MULTI_VALUE ||
         experiment.type == Experiment::ENABLE_DISABLE_VALUE);
  ListValue* result = new ListValue;
  for (int i = 0; i < experiment.num_choices; ++i) {
    DictionaryValue* value = new DictionaryValue;
    const std::string name = experiment.NameForChoice(i);
    value->SetString("internal_name", name);
    value->SetString("description", experiment.DescriptionForChoice(i));
    value->SetBoolean("selected", enabled_experiments.count(name) > 0);
    result->Append(value);
  }
  return result;
}

}  // namespace

std::string Experiment::NameForChoice(int index) const {
  DCHECK(type == Experiment::MULTI_VALUE ||
         type == Experiment::ENABLE_DISABLE_VALUE);
  DCHECK_LT(index, num_choices);
  return std::string(internal_name) + testing::kMultiSeparator +
         base::IntToString(index);
}

string16 Experiment::DescriptionForChoice(int index) const {
  DCHECK(type == Experiment::MULTI_VALUE ||
         type == Experiment::ENABLE_DISABLE_VALUE);
  DCHECK_LT(index, num_choices);
  int description_id;
  if (type == Experiment::ENABLE_DISABLE_VALUE) {
    const int kEnableDisableDescriptionIds[] = {
      IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT,
      IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
      IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
    };
    description_id = kEnableDisableDescriptionIds[index];
  } else {
    description_id = choices[index].description_id;
  }
  return l10n_util::GetStringUTF16(description_id);
}

void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line) {
  FlagsState::GetInstance()->ConvertFlagsToSwitches(prefs, command_line);
}

ListValue* GetFlagsExperimentsData(PrefService* prefs) {
  std::set<std::string> enabled_experiments;
  GetSanitizedEnabledFlags(prefs, &enabled_experiments);

  int current_platform = GetCurrentPlatform();

  ListValue* experiments_data = new ListValue();
  for (size_t i = 0; i < num_experiments; ++i) {
    const Experiment& experiment = experiments[i];

    DictionaryValue* data = new DictionaryValue();
    data->SetString("internal_name", experiment.internal_name);
    data->SetString("name",
                    l10n_util::GetStringUTF16(experiment.visible_name_id));
    data->SetString("description",
                    l10n_util::GetStringUTF16(
                        experiment.visible_description_id));
    bool supported = !!(experiment.supported_platforms & current_platform);
    data->SetBoolean("supported", supported);

    ListValue* supported_platforms = new ListValue();
    AddOsStrings(experiment.supported_platforms, supported_platforms);
    data->Set("supported_platforms", supported_platforms);

    switch (experiment.type) {
      case Experiment::SINGLE_VALUE:
        data->SetBoolean(
            "enabled",
            enabled_experiments.count(experiment.internal_name) > 0);
        break;
      case Experiment::MULTI_VALUE:
      case Experiment::ENABLE_DISABLE_VALUE:
        data->Set("choices", CreateChoiceData(experiment, enabled_experiments));
        break;
      default:
        NOTREACHED();
    }

    experiments_data->Append(data);
  }
  return experiments_data;
}

bool IsRestartNeededToCommitChanges() {
  return FlagsState::GetInstance()->IsRestartNeededToCommitChanges();
}

void SetExperimentEnabled(
    PrefService* prefs, const std::string& internal_name, bool enable) {
  FlagsState::GetInstance()->SetExperimentEnabled(prefs, internal_name, enable);
}

void RemoveFlagsSwitches(
    std::map<std::string, CommandLine::StringType>* switch_list) {
  FlagsState::GetInstance()->RemoveFlagsSwitches(switch_list);
}

void ResetAllFlags(PrefService* prefs) {
  FlagsState::GetInstance()->ResetAllFlags(prefs);
}

int GetCurrentPlatform() {
#if defined(OS_MACOSX)
  return kOsMac;
#elif defined(OS_WIN)
  return kOsWin;
#elif defined(OS_CHROMEOS)  // Needs to be before the OS_LINUX check.
  return kOsCrOS;
#elif defined(OS_LINUX) || defined(OS_OPENBSD)
  return kOsLinux;
#elif defined(OS_ANDROID)
  return kOsAndroid;
#else
#error Unknown platform
#endif
}

void RecordUMAStatistics(const PrefService* prefs) {
  std::set<std::string> flags;
  GetEnabledFlags(prefs, &flags);
  for (std::set<std::string>::iterator it = flags.begin(); it != flags.end();
       ++it) {
    std::string action("AboutFlags_");
    action += *it;
    content::RecordComputedAction(action);
  }
  // Since flag metrics are recorded every startup, add a tick so that the
  // stats can be made meaningful.
  if (flags.size())
    content::RecordAction(UserMetricsAction("AboutFlags_StartupTick"));
  content::RecordAction(UserMetricsAction("StartupTick"));
}

//////////////////////////////////////////////////////////////////////////////
// FlagsState implementation.

namespace {

typedef std::map<std::string, std::pair<std::string, std::string> >
    NameToSwitchAndValueMap;

void SetFlagToSwitchMapping(const std::string& key,
                            const std::string& switch_name,
                            const std::string& switch_value,
                            NameToSwitchAndValueMap* name_to_switch_map) {
  DCHECK(name_to_switch_map->end() == name_to_switch_map->find(key));
  (*name_to_switch_map)[key] = std::make_pair(switch_name, switch_value);
}

void FlagsState::ConvertFlagsToSwitches(
    PrefService* prefs, CommandLine* command_line) {
  if (command_line->HasSwitch(switches::kNoExperiments))
    return;

  std::set<std::string> enabled_experiments;

  GetSanitizedEnabledFlagsForCurrentPlatform(prefs, &enabled_experiments);

  NameToSwitchAndValueMap name_to_switch_map;
  for (size_t i = 0; i < num_experiments; ++i) {
    const Experiment& e = experiments[i];
    if (e.type == Experiment::SINGLE_VALUE) {
      SetFlagToSwitchMapping(e.internal_name, e.command_line_switch,
                             e.command_line_value, &name_to_switch_map);
    } else if (e.type == Experiment::MULTI_VALUE) {
      for (int j = 0; j < e.num_choices; ++j) {
        SetFlagToSwitchMapping(e.NameForChoice(j),
                               e.choices[j].command_line_switch,
                               e.choices[j].command_line_value,
                               &name_to_switch_map);
      }
    } else {
      DCHECK_EQ(e.type, Experiment::ENABLE_DISABLE_VALUE);
      SetFlagToSwitchMapping(e.NameForChoice(0), std::string(), std::string(),
                             &name_to_switch_map);
      SetFlagToSwitchMapping(e.NameForChoice(1), e.command_line_switch,
                             e.command_line_value, &name_to_switch_map);
      SetFlagToSwitchMapping(e.NameForChoice(2), e.disable_command_line_switch,
                             e.disable_command_line_value, &name_to_switch_map);
    }
  }

  command_line->AppendSwitch(switches::kFlagSwitchesBegin);
  flags_switches_.insert(
      std::pair<std::string, std::string>(switches::kFlagSwitchesBegin,
                                          std::string()));
  for (std::set<std::string>::iterator it = enabled_experiments.begin();
       it != enabled_experiments.end();
       ++it) {
    const std::string& experiment_name = *it;
    NameToSwitchAndValueMap::const_iterator name_to_switch_it =
        name_to_switch_map.find(experiment_name);
    if (name_to_switch_it == name_to_switch_map.end()) {
      NOTREACHED();
      continue;
    }

    const std::pair<std::string, std::string>&
        switch_and_value_pair = name_to_switch_it->second;

    command_line->AppendSwitchASCII(switch_and_value_pair.first,
                                    switch_and_value_pair.second);
    flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second;
  }
  command_line->AppendSwitch(switches::kFlagSwitchesEnd);
  flags_switches_.insert(
      std::pair<std::string, std::string>(switches::kFlagSwitchesEnd,
                                          std::string()));
}

bool FlagsState::IsRestartNeededToCommitChanges() {
  return needs_restart_;
}

void FlagsState::SetExperimentEnabled(
    PrefService* prefs, const std::string& internal_name, bool enable) {
  needs_restart_ = true;

  size_t at_index = internal_name.find(testing::kMultiSeparator);
  if (at_index != std::string::npos) {
    DCHECK(enable);
    // We're being asked to enable a multi-choice experiment. Disable the
    // currently selected choice.
    DCHECK_NE(at_index, 0u);
    const std::string experiment_name = internal_name.substr(0, at_index);
    SetExperimentEnabled(prefs, experiment_name, false);

    // And enable the new choice, if it is not the default first choice.
    if (internal_name != experiment_name + "@0") {
      std::set<std::string> enabled_experiments;
      GetSanitizedEnabledFlags(prefs, &enabled_experiments);
      enabled_experiments.insert(internal_name);
      SetEnabledFlags(prefs, enabled_experiments);
    }
    return;
  }

  std::set<std::string> enabled_experiments;
  GetSanitizedEnabledFlags(prefs, &enabled_experiments);

  const Experiment* e = NULL;
  for (size_t i = 0; i < num_experiments; ++i) {
    if (experiments[i].internal_name == internal_name) {
      e = experiments + i;
      break;
    }
  }
  DCHECK(e);

  if (e->type == Experiment::SINGLE_VALUE) {
    if (enable)
      enabled_experiments.insert(internal_name);
    else
      enabled_experiments.erase(internal_name);
  } else {
    if (enable) {
      // Enable the first choice.
      enabled_experiments.insert(e->NameForChoice(0));
    } else {
      // Find the currently enabled choice and disable it.
      for (int i = 0; i < e->num_choices; ++i) {
        std::string choice_name = e->NameForChoice(i);
        if (enabled_experiments.find(choice_name) !=
            enabled_experiments.end()) {
          enabled_experiments.erase(choice_name);
          // Continue on just in case there's a bug and more than one
          // experiment for this choice was enabled.
        }
      }
    }
  }

  SetEnabledFlags(prefs, enabled_experiments);
}

void FlagsState::RemoveFlagsSwitches(
    std::map<std::string, CommandLine::StringType>* switch_list) {
  for (std::map<std::string, std::string>::const_iterator
           it = flags_switches_.begin(); it != flags_switches_.end(); ++it) {
    switch_list->erase(it->first);
  }
}

void FlagsState::ResetAllFlags(PrefService* prefs) {
  needs_restart_ = true;

  std::set<std::string> no_experiments;
  SetEnabledFlags(prefs, no_experiments);
}

void FlagsState::reset() {
  needs_restart_ = false;
  flags_switches_.clear();
}

}  // namespace

namespace testing {

// WARNING: '@' is also used in the html file. If you update this constant you
// also need to update the html file.
const char kMultiSeparator[] = "@";

void ClearState() {
  FlagsState::GetInstance()->reset();
}

void SetExperiments(const Experiment* e, size_t count) {
  if (!e) {
    experiments = kExperiments;
    num_experiments = arraysize(kExperiments);
  } else {
    experiments = e;
    num_experiments = count;
  }
}

const Experiment* GetExperiments(size_t* count) {
  *count = num_experiments;
  return experiments;
}

}  // namespace testing

}  // namespace about_flags


text:
package uk.gov.gchq.gaffer.commonutil;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.junit.jupiter.api.Test;

import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class CollectionUtilTest {

    @Test
    public void shouldReturnTreeSetWithProvidedItem() {
        final String item = "test item";

        final TreeSet<String> treeSet = CollectionUtil.treeSet(item);

        assertThat(treeSet)
                .containsExactly(item);
    }

    @Test
    public void shouldReturnTreeSetWithWithOutNullItem() {
        final TreeSet<String> treeSet = CollectionUtil.treeSet(null);

        assertThat(treeSet).isEmpty();
    }

    @Test
    public void shouldReturnTreeSetWithProvidedItems() {
        final String[] items = {"test item 1", "test item 2", null};

        final TreeSet<String> treeSet = CollectionUtil.treeSet(items);

        assertThat(treeSet).hasSize(2);
        for (final String item : items) {
            if (null != item) {
                assertThat(treeSet).contains(item);
            }
        }
    }

    @Test
    public void shouldReturnTreeSetWithNoItemsForNullArray() {
        final TreeSet<String> treeSet = CollectionUtil.treeSet(null);

        assertThat(treeSet).isEmpty();
    }

    @Test
    public void shouldConvertMapToStringKeys() {
        // Given
        final Map<Class<? extends Number>, String> map = new HashMap<>();
        populateClassKeyMap(map);

        // When
        final Map<String, String> result = CollectionUtil.toMapWithStringKeys(map);

        // Then
        final Map<String, String> expectedResult = new HashMap<>();
        populateStringKeyMap(expectedResult);
        assertEquals(expectedResult, result);
    }

    @Test
    public void shouldConvertMapToStringKeysWithProvidedMap() {
        // Given
        final Map<Class<? extends Number>, String> map = new HashMap<>();
        populateClassKeyMap(map);

        final Map<String, String> result = new LinkedHashMap<>();

        // When
        CollectionUtil.toMapWithStringKeys(map, result);

        // Then
        final Map<String, String> expectedResult = new LinkedHashMap<>();
        populateStringKeyMap(expectedResult);
        assertEquals(expectedResult, result);
    }

    @Test
    public void shouldConvertMapToClassKeys() throws ClassNotFoundException {
        // Given
        final Map<String, String> map = new HashMap<>();
        populateStringKeyMap(map);

        // When
        final Map<Class<? extends Number>, String> result = CollectionUtil.toMapWithClassKeys(map);

        // Then
        final Map<Class<? extends Number>, String> expectedResult = new HashMap<>();
        populateClassKeyMap(expectedResult);
        assertEquals(expectedResult, result);
    }

    @Test
    public void shouldConvertMapToClassKeysWithProvidedMap() throws ClassNotFoundException {
        // Given
        final Map<String, String> map = new HashMap<>();
        populateStringKeyMap(map);

        final Map<Class<? extends Number>, String> result = new LinkedHashMap<>();

        // When
        CollectionUtil.toMapWithClassKeys(map, result);

        // Then
        final Map<Class<? extends Number>, String> expectedResult = new LinkedHashMap<>();
        populateClassKeyMap(expectedResult);
        assertEquals(expectedResult, result);
    }

    @Test
    public void shouldReturnTrueWhenCollectionContainsAProvidedValue() {
        // Given
        final Collection<Integer> collection = Sets.newHashSet(10, 20, 2, 30);
        final Object[] values = new Object[] {1, 2, 3};

        // When
        final boolean result = CollectionUtil.containsAny(collection, values);

        // Then
        assertTrue(result);
    }

    @Test
    public void shouldReturnFalseWhenCollectionDoesNotContainsAProvidedValue() {
        // Given
        final Collection<Integer> collection = Sets.newHashSet(10, 20, 30);
        final Object[] values = new Object[] {1, 2, 3};

        // When
        final boolean result = CollectionUtil.containsAny(collection, values);

        // Then
        assertFalse(result);
    }

    @Test
    public void shouldReturnFalseWhenContainsAnyCalledWithNullValue() {
        // Given
        final Collection<Integer> collection = Sets.newHashSet(10, 20, 30);

        // When
        final boolean result = CollectionUtil.containsAny(collection, null);

        // Then
        assertFalse(result);
    }

    @Test
    public void shouldReturnFalseWhenContainsAnyCalledWithNullCollection() {
        final Object[] values = new Object[] {1, 2, 3};

        final boolean result = CollectionUtil.containsAny(null, values);

        assertFalse(result);
    }

    @Test
    public void shouldReturnFalseWhenAnyMissingCalledWhenTheCollectionContainsAllValues() {
        // Given
        final Collection<Integer> collection = Sets.newHashSet(10, 20, 30);
        final Object[] values = new Object[] {10, 20, 30};

        // When
        final boolean result = CollectionUtil.anyMissing(collection, values);

        // Then
        assertFalse(result);
    }

    @Test
    public void shouldReturnFalseWhenAnyMissingCalledWhenNullValues() {
        // Given
        final Collection<Integer> collection = Sets.newHashSet(10, 20, 30);

        // When
        final boolean result = CollectionUtil.anyMissing(collection, null);

        // Then
        assertFalse(result);
    }

    @Test
    public void shouldReturnTrueWhenAnyMissingCalledWhenTheCollectionDoesNotContainAProvidedValue() {
        // Given
        final Collection<Integer> collection = Sets.newHashSet(10, 20, 30);
        final Object[] values = new Object[] {1, 2, 3};

        // When
        final boolean result = CollectionUtil.anyMissing(collection, values);

        // Then
        assertTrue(result);
    }

    @Test
    public void shouldReturnFalseWhenAnyMissingCalledWithNullValue() {
        // Given
        final Collection<Integer> collection = Sets.newHashSet(10, 20, 30);

        // When
        final boolean result = CollectionUtil.anyMissing(collection, null);

        // Then
        assertFalse(result);
    }

    @Test
    public void shouldReturnTrueWhenAnyMissingCalledWithNullCollectionAndSomeValues() {
        // Given
        final Object[] values = new Object[] {1, 2, 3};

        // When
        final boolean result = CollectionUtil.anyMissing(null, values);

        // Then
        assertTrue(result);
    }

    @Test
    public void shouldReturnFalseWhenAnyMissingCalledWithNullCollectionAndValues() {
        // When
        final boolean result = CollectionUtil.anyMissing(null, null);

        // Then
        assertFalse(result);
    }

    @Test
    public void shouldReturnTrueWhenDistinctCalledWithCollectionOfUniqueValues() {
        // Given
        final Collection<Integer> collection = Lists.newArrayList(1, 2, 3, 4, 5);

        // When
        final boolean result = CollectionUtil.distinct(collection);

        // Then
        assertTrue(result);
    }

    @Test
    public void shouldReturnFalseWhenDistinctCalledWithCollectionOfNonUniqueValues() {
        // Given
        final Collection<Integer> collection = Lists.newArrayList(1, 2, 3, 1, 2);

        // When
        final boolean result = CollectionUtil.distinct(collection);

        // Then
        assertFalse(result);
    }

    private void populateClassKeyMap(Map<Class<? extends Number>, String> map) {
        map.put(Integer.class, "integer");
        map.put(Double.class, "double");
        map.put(Long.class, "long");
    }

    private void populateStringKeyMap(Map<String, String> map) {
        map.put(Integer.class.getName(), "integer");
        map.put(Double.class.getName(), "double");
        map.put(Long.class.getName(), "long");
    }
}


text:
/*Generated by KISSY Module Compiler*/
KISSY.config('modules', {
'bizx': {requires: ['overlay','node','x.css']},
'bizy': {requires: ['x','y.css']}
});


text:
declare namespace javax {
  namespace naming {
    namespace spi {

      class DirStateFactory$Result {
        public constructor(arg0: java.lang.Object | any, arg1: javax.naming.directory.Attributes)
        public getObject(): java.lang.Object
        public getAttributes(): javax.naming.directory.Attributes
      }

    }
  }
}


text:
{% load i18n %}
{% load staticfiles %}

<!DOCTYPE html>

    <title>{% block title %}Shared Goals{% endblock %}</title>
    <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="{% static 'goal/goal.css' %}" rel="stylesheet">

    <link href="{% static 'goal/jquery.Jcrop.css' %}" rel="stylesheet">

    <link href="{% static 'suggestion/rateit.css' %}" rel="stylesheet">

    {% block head %}{% endblock %}

    {% block header %}{% endblock %}

    {% block content %}{% endblock %}

    {% block footer %}
    {% endblock %}


text:
package org.opensmartgridplatform.shared.application.config;

public class PagingSettings {

    private int maximumPageSize;
    private int defaultPageSize;

    private int pageSize = 0;
    private int pageNumber = 0;

    public PagingSettings(final int maximumPageSize, final int defaultPageSize) {
        this.maximumPageSize = maximumPageSize;
        this.defaultPageSize = defaultPageSize;
    }

    public int getMaximumPageSize() {
        return this.maximumPageSize;
    }

    public int getDefaultPageSize() {
        return this.defaultPageSize;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public int getPageNumber() {
        return this.pageNumber;
    }

    public void updatePagingSettings(final PageSpecifier pageSpecifier) {
        updatePagingSettings(pageSpecifier.getPageSize(), pageSpecifier.getPageNumber());
    }

    private void updatePagingSettings(final Integer pageSize, final Integer pageNumber) {
        this.pageSize = pageSize == null ? this.defaultPageSize
                : (pageSize > this.maximumPageSize ? this.maximumPageSize : pageSize);
        this.pageNumber = pageNumber == null ? 0 : pageNumber;
    }

}


text:
_This is a plugin for the `@draft-js-plugins/editor`._

This plugin allows you to add link entities via the [inline toolbar](https://www.draft-js-plugins.com/plugin/inline-toolbar). It also provides a decorator that formats the created entities. HTTP, HTTPS, as well as email addresses (with or without mailto: attached to it) are supported.

## Usage

see https://www.draft-js-plugins.com/plugin/anchor